Patch 8.2.5089
Problem: Some functions return a different value on failure.
Solution: Initialize the return value earlier. (Yegappan Lakshmanan,
closes #10568)
Files: src/autocmd.c, src/dict.c, src/evalfunc.c, src/list.c
*** ../vim-8.2.5088/src/autocmd.c 2022-06-01 16:02:34.211391158 +0100
--- src/autocmd.c 2022-06-14 13:41:08.494638224 +0100
***************
*** 3062,3067 ****
--- 3062,3069 ----
char_u *name = NULL;
int group = AUGROUP_ALL;
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
if (check_for_opt_dict_arg(argvars, 0) == FAIL)
return;
***************
*** 3128,3135 ****
}
}
- if (rettv_list_alloc(rettv) == FAIL)
- return;
event_list = rettv->vval.v_list;
// iterate through all the autocmd events
--- 3130,3135 ----
*** ../vim-8.2.5088/src/dict.c 2022-05-10 13:24:17.628706903 +0100
--- src/dict.c 2022-06-14 13:39:28.118897511 +0100
***************
*** 1457,1462 ****
--- 1457,1465 ----
dict_T *d;
int todo;
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
+
if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
return;
***************
*** 1466,1473 ****
return;
}
- if (rettv_list_alloc(rettv) == FAIL)
- return;
if ((d = argvars[0].vval.v_dict) == NULL)
// empty dict behaves like an empty dict
return;
--- 1469,1474 ----
*** ../vim-8.2.5088/src/evalfunc.c 2022-06-05 16:55:50.694774344 +0100
--- src/evalfunc.c 2022-06-14 13:39:28.122897501 +0100
***************
*** 8133,8138 ****
--- 8133,8141 ----
varnumber_T stride = 1;
int error = FALSE;
+ if (rettv_list_alloc(rettv) != OK)
+ return;
+
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
|| check_for_opt_number_arg(argvars, 1) == FAIL
***************
*** 8159,8165 ****
emsg(_(e_stride_is_zero));
else if (stride > 0 ? end + 1 < start : end - 1 > start)
emsg(_(e_start_past_end));
! else if (rettv_list_alloc(rettv) == OK)
{
list_T *list = rettv->vval.v_list;
--- 8162,8168 ----
emsg(_(e_stride_is_zero));
else if (stride > 0 ? end + 1 < start : end - 1 > start)
emsg(_(e_start_past_end));
! else
{
list_T *list = rettv->vval.v_list;
*** ../vim-8.2.5088/src/list.c 2022-04-01 15:26:54.984558728 +0100
--- src/list.c 2022-06-14 13:39:28.122897501 +0100
***************
*** 1440,1445 ****
--- 1440,1447 ----
garray_T ga;
char_u *sep;
+ rettv->v_type = VAR_STRING;
+
if (in_vim9script()
&& (check_for_list_arg(argvars, 0) == FAIL
|| check_for_opt_string_arg(argvars, 1) == FAIL))
***************
*** 1450,1456 ****
emsg(_(e_list_required));
return;
}
! rettv->v_type = VAR_STRING;
if (argvars[0].vval.v_list == NULL)
return;
--- 1452,1458 ----
emsg(_(e_list_required));
return;
}
!
if (argvars[0].vval.v_list == NULL)
return;
*** ../vim-8.2.5088/src/version.c 2022-06-14 13:30:31.640876084 +0100
--- src/version.c 2022-06-14 13:41:03.114651560 +0100
***************
*** 736,737 ****
--- 736,739 ----
{ /* Add new patch number below this line */
+ /**/
+ 5089,
/**/
--
Yesterday, all my deadlines seemed so far away
now it looks as though it's freeze in four days
oh I believe in cvs..
[ CVS log "Beatles style" for FreeBSD ports/INDEX, Satoshi Asami ]
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///