Mercurial > vim
comparison src/userfunc.c @ 27028:c9474ae175f4 v8.2.4043
patch 8.2.4043: using int for second argument of ga_init2()
Commit: https://github.com/vim/vim/commit/04935fb17e5f0f66b82cf4546b9752d3d1fa650e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 8 16:19:22 2022 +0000
patch 8.2.4043: using int for second argument of ga_init2()
Problem: Using int for second argument of ga_init2().
Solution: Remove unnessary type cast (int) when using sizeof().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Jan 2022 17:30:04 +0100 |
parents | eebbcc83fb75 |
children | 15f40772e10a |
comparison
equal
deleted
inserted
replaced
27027:167e35b85720 | 27028:c9474ae175f4 |
---|---|
220 int any_default = FALSE; | 220 int any_default = FALSE; |
221 char_u *expr; | 221 char_u *expr; |
222 char_u *whitep = *argp; | 222 char_u *whitep = *argp; |
223 | 223 |
224 if (newargs != NULL) | 224 if (newargs != NULL) |
225 ga_init2(newargs, (int)sizeof(char_u *), 3); | 225 ga_init2(newargs, sizeof(char_u *), 3); |
226 if (argtypes != NULL) | 226 if (argtypes != NULL) |
227 ga_init2(argtypes, (int)sizeof(char_u *), 3); | 227 ga_init2(argtypes, sizeof(char_u *), 3); |
228 if (!skip && default_args != NULL) | 228 if (!skip && default_args != NULL) |
229 ga_init2(default_args, (int)sizeof(char_u *), 3); | 229 ga_init2(default_args, sizeof(char_u *), 3); |
230 | 230 |
231 if (varargs != NULL) | 231 if (varargs != NULL) |
232 *varargs = FALSE; | 232 *varargs = FALSE; |
233 | 233 |
234 /* | 234 /* |
1147 { | 1147 { |
1148 eap.getline = evalarg->eval_getline; | 1148 eap.getline = evalarg->eval_getline; |
1149 eap.cookie = evalarg->eval_cookie; | 1149 eap.cookie = evalarg->eval_cookie; |
1150 } | 1150 } |
1151 | 1151 |
1152 ga_init2(&newlines, (int)sizeof(char_u *), 10); | 1152 ga_init2(&newlines, sizeof(char_u *), 10); |
1153 if (get_function_body(&eap, &newlines, NULL, | 1153 if (get_function_body(&eap, &newlines, NULL, |
1154 &evalarg->eval_tofree_ga) == FAIL) | 1154 &evalarg->eval_tofree_ga) == FAIL) |
1155 goto erret; | 1155 goto erret; |
1156 | 1156 |
1157 // When inside a lambda must add the function lines to evalarg.eval_ga. | 1157 // When inside a lambda must add the function lines to evalarg.eval_ga. |
1434 fp->uf_def_status = UF_NOT_COMPILED; | 1434 fp->uf_def_status = UF_NOT_COMPILED; |
1435 pt = ALLOC_CLEAR_ONE(partial_T); | 1435 pt = ALLOC_CLEAR_ONE(partial_T); |
1436 if (pt == NULL) | 1436 if (pt == NULL) |
1437 goto errret; | 1437 goto errret; |
1438 | 1438 |
1439 ga_init2(&newlines, (int)sizeof(char_u *), 1); | 1439 ga_init2(&newlines, sizeof(char_u *), 1); |
1440 if (ga_grow(&newlines, 1) == FAIL) | 1440 if (ga_grow(&newlines, 1) == FAIL) |
1441 goto errret; | 1441 goto errret; |
1442 | 1442 |
1443 // If there are line breaks, we need to split up the string. | 1443 // If there are line breaks, we need to split up the string. |
1444 line_end = vim_strchr(start, '\n'); | 1444 line_end = vim_strchr(start, '\n'); |
1758 if (get_vim_var_nr(VV_TESTING)) | 1758 if (get_vim_var_nr(VV_TESTING)) |
1759 { | 1759 { |
1760 // Prepare for calling test_garbagecollect_now(), need to know | 1760 // Prepare for calling test_garbagecollect_now(), need to know |
1761 // what variables are used on the call stack. | 1761 // what variables are used on the call stack. |
1762 if (funcargs.ga_itemsize == 0) | 1762 if (funcargs.ga_itemsize == 0) |
1763 ga_init2(&funcargs, (int)sizeof(typval_T *), 50); | 1763 ga_init2(&funcargs, sizeof(typval_T *), 50); |
1764 for (i = 0; i < argcount; ++i) | 1764 for (i = 0; i < argcount; ++i) |
1765 if (ga_grow(&funcargs, 1) == OK) | 1765 if (ga_grow(&funcargs, 1) == OK) |
1766 ((typval_T **)funcargs.ga_data)[funcargs.ga_len++] = | 1766 ((typval_T **)funcargs.ga_data)[funcargs.ga_len++] = |
1767 &argvars[i]; | 1767 &argvars[i]; |
1768 } | 1768 } |
4171 { | 4171 { |
4172 emsg(_(e_no_bang_allowed)); | 4172 emsg(_(e_no_bang_allowed)); |
4173 goto ret_free; | 4173 goto ret_free; |
4174 } | 4174 } |
4175 | 4175 |
4176 ga_init2(&newlines, (int)sizeof(char_u *), 10); | 4176 ga_init2(&newlines, sizeof(char_u *), 10); |
4177 | 4177 |
4178 if (!eap->skip && name_arg == NULL) | 4178 if (!eap->skip && name_arg == NULL) |
4179 { | 4179 { |
4180 // Check the name of the function. Unless it's a dictionary function | 4180 // Check the name of the function. Unless it's a dictionary function |
4181 // (that we are overwriting). | 4181 // (that we are overwriting). |