]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK v8.2.5107
authorBram Moolenaar <Bram@vim.org>
Thu, 16 Jun 2022 10:42:09 +0000 (11:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 16 Jun 2022 10:42:09 +0000 (11:42 +0100)
Problem:    Some callers of rettv_list_alloc() check for not OK. (Christ van
            Willegen)
Solution:   Use "==" instead of "!=" when checking the return value.

17 files changed:
src/channel.c
src/cmdexpand.c
src/evalbuffer.c
src/evalfunc.c
src/evalwindow.c
src/insexpand.c
src/job.c
src/list.c
src/map.c
src/menu.c
src/mouse.c
src/move.c
src/sign.c
src/term.c
src/textprop.c
src/time.c
src/version.c

index abd2ce1da0f892af9b8ef6240b192b3aa74d3ea5..8a64d1756ab898a83605b755f2c38a36f0b29d78 100644 (file)
@@ -5275,7 +5275,7 @@ f_ch_info(typval_T *argvars, typval_T *rettv UNUSED)
        return;
 
     channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
-    if (channel != NULL && rettv_dict_alloc(rettv) != FAIL)
+    if (channel != NULL && rettv_dict_alloc(rettv) == OK)
        channel_info(channel, rettv->vval.v_dict);
 }
 
index c3731cb645bd80b0f69b5b33a1a8c5a59f1fa9eb..28ecaeda976ab3d791ce9f716d034af3d680d0b3 100644 (file)
@@ -3754,7 +3754,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
     else
        pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
 
-    if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
+    if (rettv_list_alloc(rettv) == OK && pat != NULL)
     {
        int     i;
 
index 7de7271770bd2d4d5807b5d7333ac1b3cc62f65d..0808c7e6a269f5e9d009b9b140081b9a91ef6254 100644 (file)
@@ -680,7 +680,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
     int                sel_bufloaded = FALSE;
     int                sel_bufmodified = FALSE;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script()
index d85e85460c08fbd7fa635d3cc4b4d72357e8e207..6335a6469c9ea0d0af3279a5f805196fee380946 100644 (file)
@@ -3732,7 +3732,7 @@ f_environ(typval_T *argvars UNUSED, typval_T *rettv)
     extern char                **environ;
 # endif
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
 
 # ifdef MSWIN
@@ -4159,7 +4159,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
            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 @@ f_expand(typval_T *argvars, typval_T *rettv)
            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 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
     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 @@ f_getcharpos(typval_T *argvars UNUSED, typval_T *rettv)
     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 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
     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 @@ f_gettagstack(typval_T *argvars, typval_T *rettv)
 {
     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 @@ f_printf(typval_T *argvars, typval_T *rettv)
     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 @@ f_range(typval_T *argvars, typval_T *rettv)
     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 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
 
     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 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv)
 
     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 @@ f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
        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,
index 20ac66f53350941c7fa9ab46f75bcf7b4a868b19..00d63cd3658c312f0c9c62c7e157decf110bc41a 100644 (file)
@@ -471,7 +471,7 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv)
     dict_T     *d;
     int                tpnr = 0;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
@@ -510,7 +510,7 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
     dict_T     *d;
     short      tabnr = 0, winnr;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
@@ -779,7 +779,7 @@ f_win_findbuf(typval_T *argvars, typval_T *rettv)
     if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
 
-    if (rettv_list_alloc(rettv) != FAIL)
+    if (rettv_list_alloc(rettv) == OK)
        win_findbuf(argvars, rettv->vval.v_list);
 }
 
@@ -847,7 +847,7 @@ f_win_id2tabwin(typval_T *argvars, typval_T *rettv)
     if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
 
-    if (rettv_list_alloc(rettv) != FAIL)
+    if (rettv_list_alloc(rettv) == OK)
        win_id2tabwin(argvars, rettv->vval.v_list);
 }
 
@@ -1143,7 +1143,7 @@ f_winlayout(typval_T *argvars, typval_T *rettv)
 {
     tabpage_T  *tp;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
index 20df1b0f37aef2e232218ac192aca73a3ba4b3ed..4a5feac9dc1f71b4c11fc6b4fdee7d8bf0b8516a 100644 (file)
@@ -3089,7 +3089,7 @@ f_complete_info(typval_T *argvars, typval_T *rettv)
 {
     list_T     *what_list = NULL;
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
index 7cce61181b33dbdf6969bc80fbafbc0bcbadf903..7dbfc7de9d32d1d6b84c0d4b63d5c1b22094b28b 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -1893,7 +1893,7 @@ f_job_info(typval_T *argvars, typval_T *rettv)
        job_T   *job;
 
        job = get_job_arg(&argvars[0]);
-       if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
+       if (job != NULL && rettv_dict_alloc(rettv) == OK)
            job_info(job, rettv->vval.v_dict);
     }
     else if (rettv_list_alloc(rettv) == OK)
index b9a347836bd0a2e5021d87e27f06b6bfa377dbd2..10a7aacd355f7d64af22ff1cc17849fbdf4d0fd7 100644 (file)
@@ -1762,7 +1762,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
     }
 
     vimlist_remove(l, item, item2);
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     rl = rettv->vval.v_list;
index 80ac8aa068a3a1a2290e37e322a41a54334e78d8..9570285cd7873f1e38c3121ff74d201a77cc713f 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -2379,7 +2379,7 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
        }
 
     }
-    else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
+    else if (rettv_dict_alloc(rettv) == OK && rhs != NULL)
        mapblock2dict(mp, rettv->vval.v_dict,
                          did_simplify ? keys_simplified : NULL,
                          buffer_local, abbr);
@@ -2409,7 +2409,7 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv)
     if (argvars[0].v_type != VAR_UNKNOWN)
        abbr = tv_get_bool(&argvars[0]);
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     validate_maphash();
index 95f6fae9566959b6d3031bc2815531a21aa4d080..a5886742267736d8462fb03d4ef16a8ab4c6004d 100644 (file)
@@ -2945,7 +2945,7 @@ f_menu_info(typval_T *argvars, typval_T *rettv)
     vimmenu_T  *menu;
     dict_T     *retdict;
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
     retdict = rettv->vval.v_dict;
 
index a66c00d872578e09a32cd4b93f7c43aea0b24a45..2297f81826d2b52f6953a56dae2fb9054ec87cf4 100644 (file)
@@ -3099,7 +3099,7 @@ f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
     linenr_T   lnum = 0;
     varnumber_T column = 0;
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
     d = rettv->vval.v_dict;
 
index 5c78d6ce058c2978560715e282256ad2fdd06c9c..5865af8a5cf5daf00ca260bacab2cfecc7e35f94 100644 (file)
@@ -1298,7 +1298,7 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv)
     int                row = 0;
     int                scol = 0, ccol = 0, ecol = 0;
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
     dict = rettv->vval.v_dict;
 
index 673d9027517a9dae96fc1cb213b911bd8e0da355..ee36d335436df5eee32c8320bcd0b6c0f7a60994 100644 (file)
@@ -2335,7 +2335,7 @@ f_sign_define(typval_T *argvars, typval_T *rettv)
     if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
     {
        // Define multiple signs
-       if (rettv_list_alloc(rettv) != OK)
+       if (rettv_list_alloc(rettv) == FAIL)
            return;
 
        sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
@@ -2367,7 +2367,7 @@ f_sign_getdefined(typval_T *argvars, typval_T *rettv)
 {
     char_u     *name = NULL;
 
-    if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
+    if (rettv_list_alloc_id(rettv, aid_sign_getdefined) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
@@ -2393,7 +2393,7 @@ f_sign_getplaced(typval_T *argvars, typval_T *rettv)
     char_u     *group = NULL;
     int                notanum = FALSE;
 
-    if (rettv_list_alloc_id(rettv, aid_sign_getplaced) != OK)
+    if (rettv_list_alloc_id(rettv, aid_sign_getplaced) == FAIL)
        return;
 
     if (in_vim9script()
@@ -2661,7 +2661,7 @@ f_sign_placelist(typval_T *argvars, typval_T *rettv)
     listitem_T *li;
     int                sign_id;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
@@ -2721,7 +2721,7 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv)
     if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
     {
        // Undefine multiple signs
-       if (rettv_list_alloc(rettv) != OK)
+       if (rettv_list_alloc(rettv) == FAIL)
            return;
 
        sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
@@ -2892,7 +2892,7 @@ f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
     listitem_T *li;
     int                retval;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
index 9e26eabb796fea02d434d2ad2299e9607bef7e4a..c40f9f545e69a6d47eca3c5f668c87fe32e177e0 100644 (file)
@@ -1470,7 +1470,7 @@ f_terminalprops(typval_T *argvars UNUSED, typval_T *rettv)
     int i;
 # endif
 
-    if (rettv_dict_alloc(rettv) != OK)
+    if (rettv_dict_alloc(rettv) == FAIL)
        return;
 # ifdef FEAT_TERMRESPONSE
     for (i = 0; i < TPR_COUNT; ++i)
index 9d3487fde2f4f9b8bb4f497272b84bfb1fb2439d..9198665b7cdfdb6e236b9bb5403b8c946b545152 100644 (file)
@@ -1076,7 +1076,7 @@ f_prop_list(typval_T *argvars, typval_T *rettv)
                || check_for_opt_dict_arg(argvars, 1) == FAIL))
        return;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     // default: get text properties on current line
index d76874243ccc3f8e3710201060917da268b5919e..4adcce59fb8fdb461e1d9c7470223b568032f421 100644 (file)
@@ -172,7 +172,7 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
     proftime_T start;
     long       n1, n2;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script()
@@ -787,7 +787,7 @@ f_timer_info(typval_T *argvars, typval_T *rettv)
 {
     timer_T *timer = NULL;
 
-    if (rettv_list_alloc(rettv) != OK)
+    if (rettv_list_alloc(rettv) == FAIL)
        return;
 
     if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
index c2582636f960a6a9ed7765a9760d3226f882a70c..81270a33638c4ed2e53032e72ff5c18f783eadb1 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5107,
 /**/
     5106,
 /**/