mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
patch 8.2.5089: some functions return a different value on failure
Problem: Some functions return a different value on failure. Solution: Initialize the return value earlier. (Yegappan Lakshmanan, closes #10568)
This commit is contained in:
committed by
Bram Moolenaar
parent
cd7496382e
commit
ca195cc84f
@ -3062,6 +3062,8 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
|
||||
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,8 +3130,6 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
event_list = rettv->vval.v_list;
|
||||
|
||||
// iterate through all the autocmd events
|
||||
|
@ -1457,6 +1457,9 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
|
||||
dict_T *d;
|
||||
int todo;
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
|
||||
return;
|
||||
|
||||
@ -1466,8 +1469,6 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
|
||||
return;
|
||||
}
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
if ((d = argvars[0].vval.v_dict) == NULL)
|
||||
// empty dict behaves like an empty dict
|
||||
return;
|
||||
|
@ -8133,6 +8133,9 @@ f_range(typval_T *argvars, typval_T *rettv)
|
||||
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,7 +8162,7 @@ f_range(typval_T *argvars, typval_T *rettv)
|
||||
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)
|
||||
else
|
||||
{
|
||||
list_T *list = rettv->vval.v_list;
|
||||
|
||||
|
@ -1440,6 +1440,8 @@ f_join(typval_T *argvars, typval_T *rettv)
|
||||
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,7 +1452,7 @@ f_join(typval_T *argvars, typval_T *rettv)
|
||||
emsg(_(e_list_required));
|
||||
return;
|
||||
}
|
||||
rettv->v_type = VAR_STRING;
|
||||
|
||||
if (argvars[0].vval.v_list == NULL)
|
||||
return;
|
||||
|
||||
|
@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
5089,
|
||||
/**/
|
||||
5088,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user