Patch 9.0.0520
Problem: Declaring a loop variable at the start of a block is clumsy.
Solution: Declare the variable inside the loop in a few places to see if
this works.
Files: src/evalfunc.c
*** ../vim-9.0.0519/src/evalfunc.c 2022-09-17 21:07:52.095993168 +0100
--- src/evalfunc.c 2022-09-20 19:04:02.408831296 +0100
***************
*** 2877,2883 ****
cctx_T *cctx)
{
argcheck_T *argchecks = global_functions[idx].f_argcheck;
- int i;
if (argchecks != NULL)
{
--- 2877,2882 ----
***************
*** 2886,2892 ****
context.arg_count = argcount;
context.arg_types = types;
context.arg_cctx = cctx;
! for (i = 0; i < argcount; ++i)
if (argchecks[i] != NULL)
{
context.arg_idx = i;
--- 2885,2891 ----
context.arg_count = argcount;
context.arg_types = types;
context.arg_cctx = cctx;
! for (int i = 0; i < argcount; ++i)
if (argchecks[i] != NULL)
{
context.arg_idx = i;
***************
*** 3010,3016 ****
typval_T *rettv,
typval_T *basetv)
{
- int i;
int fi;
typval_T argv[MAX_FUNC_ARGS + 1];
--- 3009,3014 ----
***************
*** 3029,3035 ****
// base value goes second
argv[0] = argvars[0];
argv[1] = *basetv;
! for (i = 1; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else if (global_functions[fi].f_argtype == FEARG_3)
--- 3027,3033 ----
// base value goes second
argv[0] = argvars[0];
argv[1] = *basetv;
! for (int i = 1; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else if (global_functions[fi].f_argtype == FEARG_3)
***************
*** 3038,3044 ****
argv[0] = argvars[0];
argv[1] = argvars[1];
argv[2] = *basetv;
! for (i = 2; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else if (global_functions[fi].f_argtype == FEARG_4)
--- 3036,3042 ----
argv[0] = argvars[0];
argv[1] = argvars[1];
argv[2] = *basetv;
! for (int i = 2; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else if (global_functions[fi].f_argtype == FEARG_4)
***************
*** 3048,3061 ****
argv[1] = argvars[1];
argv[2] = argvars[2];
argv[3] = *basetv;
! for (i = 3; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else
{
// FEARG_1: base value goes first
argv[0] = *basetv;
! for (i = 0; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
argv[argcount + 1].v_type = VAR_UNKNOWN;
--- 3046,3059 ----
argv[1] = argvars[1];
argv[2] = argvars[2];
argv[3] = *basetv;
! for (int i = 3; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
else
{
// FEARG_1: base value goes first
argv[0] = *basetv;
! for (int i = 0; i < argcount; ++i)
argv[i + 1] = argvars[i];
}
argv[argcount + 1].v_type = VAR_UNKNOWN;
***************
*** 3162,3171 ****
{
pumitem_T *array;
int size = split_message(msg, &array);
- int i;
// Skip the first and last item, they are always empty.
! for (i = 1; i < size - 1; ++i)
list_append_string(rettv->vval.v_list, array[i].pum_text, -1);
while (size > 0)
vim_free(array[--size].pum_text);
--- 3160,3168 ----
{
pumitem_T *array;
int size = split_message(msg, &array);
// Skip the first and last item, they are always empty.
! for (int i = 1; i < size - 1; ++i)
list_append_string(rettv->vval.v_list, array[i].pum_text, -1);
while (size > 0)
vim_free(array[--size].pum_text);
***************
*** 4183,4192 ****
options, WILD_ALL);
else if (rettv_list_alloc(rettv) == OK)
{
- int i;
-
ExpandOne(&xpc, s, NULL, options, WILD_ALL_KEEP);
! for (i = 0; i < xpc.xp_numfiles; i++)
list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
ExpandCleanup(&xpc);
}
--- 4180,4187 ----
options, WILD_ALL);
else if (rettv_list_alloc(rettv) == OK)
{
ExpandOne(&xpc, s, NULL, options, WILD_ALL_KEEP);
! for (int i = 0; i < xpc.xp_numfiles; i++)
list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
ExpandCleanup(&xpc);
}
***************
*** 4301,4310 ****
if (lowlevel)
{
#ifdef USE_INPUT_BUF
- int idx;
int len = (int)STRLEN(keys);
! for (idx = 0; idx < len; ++idx)
{
// if a CTRL-C was typed, set got_int, similar to what
// happens in fill_input_buf()
--- 4296,4304 ----
if (lowlevel)
{
#ifdef USE_INPUT_BUF
int len = (int)STRLEN(keys);
! for (int idx = 0; idx < len; ++idx)
{
// if a CTRL-C was typed, set got_int, similar to what
// happens in fill_input_buf()
*** ../vim-9.0.0519/src/version.c 2022-09-20 18:59:26.397606818 +0100
--- src/version.c 2022-09-20 19:02:19.793115008 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 520,
/**/
--
Nobody will ever need more than 640 kB RAM.
-- Bill Gates, 1983
Windows 98 requires 16 MB RAM.
-- Bill Gates, 1999
Logical conclusion: Nobody will ever need Windows 98.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220920180505.57B8E1C0846%40moolenaar.net.