patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Problem: Some callers of rettv_list_alloc() check for not OK. (Christ van
Willegen)
Solution: Use "==" instead of "!=" when checking the return value.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index d85e854..6335a64 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3732,7 +3732,7 @@
extern char **environ;
# endif
- if (rettv_dict_alloc(rettv) != OK)
+ if (rettv_dict_alloc(rettv) == FAIL)
return;
# ifdef MSWIN
@@ -4159,7 +4159,7 @@
emsg(errormsg);
if (rettv->v_type == VAR_LIST)
{
- if (rettv_list_alloc(rettv) != FAIL && result != NULL)
+ if (rettv_list_alloc(rettv) == OK && result != NULL)
list_append_string(rettv->vval.v_list, result, -1);
vim_free(result);
}
@@ -4182,7 +4182,7 @@
if (rettv->v_type == VAR_STRING)
rettv->vval.v_string = ExpandOne(&xpc, s, NULL,
options, WILD_ALL);
- else if (rettv_list_alloc(rettv) != FAIL)
+ else if (rettv_list_alloc(rettv) == OK)
{
int i;
@@ -4784,7 +4784,7 @@
dict_T *d;
int changelistindex;
- if (rettv_list_alloc(rettv) != OK)
+ if (rettv_list_alloc(rettv) == FAIL)
return;
if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
@@ -4929,7 +4929,7 @@
static void
f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
{
- if (rettv_dict_alloc(rettv) != FAIL)
+ if (rettv_dict_alloc(rettv) == OK)
{
dict_T *dict = rettv->vval.v_dict;
@@ -5016,7 +5016,7 @@
list_T *l;
dict_T *d;
- if (rettv_list_alloc(rettv) != OK)
+ if (rettv_list_alloc(rettv) == FAIL)
return;
if (in_vim9script()
@@ -5221,7 +5221,7 @@
{
win_T *wp = curwin; // default is current window
- if (rettv_dict_alloc(rettv) != OK)
+ if (rettv_dict_alloc(rettv) == FAIL)
return;
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
@@ -7844,7 +7844,7 @@
static void
f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
- if (rettv_dict_alloc(rettv) != OK)
+ if (rettv_dict_alloc(rettv) == FAIL)
return;
pum_set_event_info(rettv->vval.v_dict);
}
@@ -8133,7 +8133,7 @@
varnumber_T stride = 1;
int error = FALSE;
- if (rettv_list_alloc(rettv) != OK)
+ if (rettv_list_alloc(rettv) == FAIL)
return;
if (in_vim9script()
@@ -10197,7 +10197,7 @@
CLEAR_FIELD(str);
- if (rettv_list_alloc(rettv) != FAIL)
+ if (rettv_list_alloc(rettv) == OK)
{
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
&& col >= 0 && col <= (long)STRLEN(ml_get(lnum))
@@ -10258,7 +10258,7 @@
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
&& col >= 0 && col <= (long)STRLEN(ml_get(lnum))
- && rettv_list_alloc(rettv) != FAIL)
+ && rettv_list_alloc(rettv) == OK)
{
(void)syn_get_id(curwin, lnum, col, FALSE, NULL, TRUE);
for (i = 0; ; ++i)
@@ -10293,7 +10293,7 @@
if (tp != NULL)
wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
}
- if (wp != NULL && rettv_list_alloc(rettv) != FAIL)
+ if (wp != NULL && rettv_list_alloc(rettv) == OK)
{
for (; wp != NULL; wp = wp->w_next)
if (list_append_number(rettv->vval.v_list,