Patch 8.2.5107
Problem:    Some callers of rettv_list_alloc() check for not OK. (Christ van
            Willegen)
Solution:   Use "==" instead of "!=" when checking the return value.
Files:      src/evalbuffer.c, src/channel.c, src/cmdexpand.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/textprop.c, src/term.c, src/time.c


*** ../vim-8.2.5106/src/evalbuffer.c    2022-05-22 15:35:39.918194213 +0100
--- src/evalbuffer.c    2022-06-16 11:27:01.581715191 +0100
***************
*** 680,686 ****
      int               sel_bufloaded = FALSE;
      int               sel_bufmodified = FALSE;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script()
--- 680,686 ----
      int               sel_bufloaded = FALSE;
      int               sel_bufmodified = FALSE;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script()
*** ../vim-8.2.5106/src/channel.c       2022-06-04 22:15:48.788982835 +0100
--- src/channel.c       2022-06-16 11:35:29.668625206 +0100
***************
*** 5275,5281 ****
        return;
  
      channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
!     if (channel != NULL && rettv_dict_alloc(rettv) != FAIL)
        channel_info(channel, rettv->vval.v_dict);
  }
  
--- 5275,5281 ----
        return;
  
      channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
!     if (channel != NULL && rettv_dict_alloc(rettv) == OK)
        channel_info(channel, rettv->vval.v_dict);
  }
  
*** ../vim-8.2.5106/src/cmdexpand.c     2022-05-08 21:10:52.653899496 +0100
--- src/cmdexpand.c     2022-06-16 11:40:45.096144731 +0100
***************
*** 3754,3760 ****
      else
         pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
  
!     if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
      {
        int     i;
  
--- 3754,3760 ----
      else
         pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
  
!     if (rettv_list_alloc(rettv) == OK && pat != NULL)
      {
        int     i;
  
*** ../vim-8.2.5106/src/evalfunc.c      2022-06-14 13:42:23.078459292 +0100
--- src/evalfunc.c      2022-06-16 11:36:45.628500564 +0100
***************
*** 3732,3738 ****
      extern char               **environ;
  # endif
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
  
  # ifdef MSWIN
--- 3732,3738 ----
      extern char               **environ;
  # endif
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
  
  # ifdef MSWIN
***************
*** 4159,4165 ****
            emsg(errormsg);
        if (rettv->v_type == VAR_LIST)
        {
!           if (rettv_list_alloc(rettv) != FAIL && result != NULL)
                list_append_string(rettv->vval.v_list, result, -1);
            vim_free(result);
        }
--- 4159,4165 ----
            emsg(errormsg);
        if (rettv->v_type == VAR_LIST)
        {
!           if (rettv_list_alloc(rettv) == OK && result != NULL)
                list_append_string(rettv->vval.v_list, result, -1);
            vim_free(result);
        }
***************
*** 4182,4188 ****
            if (rettv->v_type == VAR_STRING)
                rettv->vval.v_string = ExpandOne(&xpc, s, NULL,
                                                           options, WILD_ALL);
!           else if (rettv_list_alloc(rettv) != FAIL)
            {
                int i;
  
--- 4182,4188 ----
            if (rettv->v_type == VAR_STRING)
                rettv->vval.v_string = ExpandOne(&xpc, s, NULL,
                                                           options, WILD_ALL);
!           else if (rettv_list_alloc(rettv) == OK)
            {
                int i;
  
***************
*** 4784,4790 ****
      dict_T    *d;
      int               changelistindex;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
--- 4784,4790 ----
      dict_T    *d;
      int               changelistindex;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
***************
*** 4929,4935 ****
      static void
  f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
  {
!     if (rettv_dict_alloc(rettv) != FAIL)
      {
        dict_T *dict = rettv->vval.v_dict;
  
--- 4929,4935 ----
      static void
  f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
  {
!     if (rettv_dict_alloc(rettv) == OK)
      {
        dict_T *dict = rettv->vval.v_dict;
  
***************
*** 5016,5022 ****
      list_T    *l;
      dict_T    *d;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script()
--- 5016,5022 ----
      list_T    *l;
      dict_T    *d;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script()
***************
*** 5221,5227 ****
  {
      win_T     *wp = curwin;                   // default is current window
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
--- 5221,5227 ----
  {
      win_T     *wp = curwin;                   // default is current window
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
***************
*** 7844,7850 ****
      static void
  f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
  {
!     if (rettv_dict_alloc(rettv) != OK)
        return;
      pum_set_event_info(rettv->vval.v_dict);
  }
--- 7844,7850 ----
      static void
  f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
  {
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
      pum_set_event_info(rettv->vval.v_dict);
  }
***************
*** 8133,8139 ****
      varnumber_T       stride = 1;
      int               error = FALSE;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script()
--- 8133,8139 ----
      varnumber_T       stride = 1;
      int               error = FALSE;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script()
***************
*** 10197,10203 ****
  
      CLEAR_FIELD(str);
  
!     if (rettv_list_alloc(rettv) != FAIL)
      {
        if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
            && col >= 0 && col <= (long)STRLEN(ml_get(lnum))
--- 10197,10203 ----
  
      CLEAR_FIELD(str);
  
!     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,10264 ****
  
      if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
            && col >= 0 && col <= (long)STRLEN(ml_get(lnum))
!           && rettv_list_alloc(rettv) != FAIL)
      {
        (void)syn_get_id(curwin, lnum, col, FALSE, NULL, TRUE);
        for (i = 0; ; ++i)
--- 10258,10264 ----
  
      if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
            && col >= 0 && col <= (long)STRLEN(ml_get(lnum))
!           && rettv_list_alloc(rettv) == OK)
      {
        (void)syn_get_id(curwin, lnum, col, FALSE, NULL, TRUE);
        for (i = 0; ; ++i)
***************
*** 10293,10299 ****
        if (tp != NULL)
            wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
      }
!     if (wp != NULL && rettv_list_alloc(rettv) != FAIL)
      {
        for (; wp != NULL; wp = wp->w_next)
            if (list_append_number(rettv->vval.v_list,
--- 10293,10299 ----
        if (tp != NULL)
            wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
      }
!     if (wp != NULL && rettv_list_alloc(rettv) == OK)
      {
        for (; wp != NULL; wp = wp->w_next)
            if (list_append_number(rettv->vval.v_list,
*** ../vim-8.2.5106/src/evalwindow.c    2022-05-09 20:09:19.282641427 +0100
--- src/evalwindow.c    2022-06-16 11:31:00.497134013 +0100
***************
*** 471,477 ****
      dict_T    *d;
      int               tpnr = 0;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
--- 471,477 ----
      dict_T    *d;
      int               tpnr = 0;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
***************
*** 510,516 ****
      dict_T    *d;
      short     tabnr = 0, winnr;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
--- 510,516 ----
      dict_T    *d;
      short     tabnr = 0, winnr;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
***************
*** 779,785 ****
      if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
  
!     if (rettv_list_alloc(rettv) != FAIL)
        win_findbuf(argvars, rettv->vval.v_list);
  }
  
--- 779,785 ----
      if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
  
!     if (rettv_list_alloc(rettv) == OK)
        win_findbuf(argvars, rettv->vval.v_list);
  }
  
***************
*** 847,853 ****
      if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
  
!     if (rettv_list_alloc(rettv) != FAIL)
        win_id2tabwin(argvars, rettv->vval.v_list);
  }
  
--- 847,853 ----
      if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
        return;
  
!     if (rettv_list_alloc(rettv) == OK)
        win_id2tabwin(argvars, rettv->vval.v_list);
  }
  
***************
*** 1143,1149 ****
  {
      tabpage_T *tp;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
--- 1143,1149 ----
  {
      tabpage_T *tp;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
*** ../vim-8.2.5106/src/insexpand.c     2022-05-27 17:26:50.542119974 +0100
--- src/insexpand.c     2022-06-16 11:37:00.288477253 +0100
***************
*** 3089,3095 ****
  {
      list_T    *what_list = NULL;
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
--- 3089,3095 ----
  {
      list_T    *what_list = NULL;
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
*** ../vim-8.2.5106/src/job.c   2022-05-20 10:10:29.944122696 +0100
--- src/job.c   2022-06-16 11:37:08.532464244 +0100
***************
*** 1893,1899 ****
        job_T   *job;
  
        job = get_job_arg(&argvars[0]);
!       if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
            job_info(job, rettv->vval.v_dict);
      }
      else if (rettv_list_alloc(rettv) == OK)
--- 1893,1899 ----
        job_T   *job;
  
        job = get_job_arg(&argvars[0]);
!       if (job != NULL && rettv_dict_alloc(rettv) == OK)
            job_info(job, rettv->vval.v_dict);
      }
      else if (rettv_list_alloc(rettv) == OK)
*** ../vim-8.2.5106/src/list.c  2022-06-14 13:42:23.078459292 +0100
--- src/list.c  2022-06-16 11:31:58.425013882 +0100
***************
*** 1762,1768 ****
      }
  
      vimlist_remove(l, item, item2);
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      rl = rettv->vval.v_list;
--- 1762,1768 ----
      }
  
      vimlist_remove(l, item, item2);
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      rl = rettv->vval.v_list;
*** ../vim-8.2.5106/src/map.c   2022-06-16 11:14:51.953291054 +0100
--- src/map.c   2022-06-16 11:37:17.724449828 +0100
***************
*** 2379,2385 ****
        }
  
      }
!     else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
        mapblock2dict(mp, rettv->vval.v_dict,
                          did_simplify ? keys_simplified : NULL,
                          buffer_local, abbr);
--- 2379,2385 ----
        }
  
      }
!     else if (rettv_dict_alloc(rettv) == OK && rhs != NULL)
        mapblock2dict(mp, rettv->vval.v_dict,
                          did_simplify ? keys_simplified : NULL,
                          buffer_local, abbr);
***************
*** 2409,2415 ****
      if (argvars[0].v_type != VAR_UNKNOWN)
        abbr = tv_get_bool(&argvars[0]);
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      validate_maphash();
--- 2409,2415 ----
      if (argvars[0].v_type != VAR_UNKNOWN)
        abbr = tv_get_bool(&argvars[0]);
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      validate_maphash();
*** ../vim-8.2.5106/src/menu.c  2022-05-09 20:09:19.286641426 +0100
--- src/menu.c  2022-06-16 11:37:36.728420281 +0100
***************
*** 2945,2951 ****
      vimmenu_T *menu;
      dict_T    *retdict;
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
      retdict = rettv->vval.v_dict;
  
--- 2945,2951 ----
      vimmenu_T *menu;
      dict_T    *retdict;
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
      retdict = rettv->vval.v_dict;
  
*** ../vim-8.2.5106/src/mouse.c 2022-05-21 20:16:51.007567185 +0100
--- src/mouse.c 2022-06-16 11:37:51.180398049 +0100
***************
*** 3099,3105 ****
      linenr_T  lnum = 0;
      varnumber_T column = 0;
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
      d = rettv->vval.v_dict;
  
--- 3099,3105 ----
      linenr_T  lnum = 0;
      varnumber_T column = 0;
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
      d = rettv->vval.v_dict;
  
*** ../vim-8.2.5106/src/move.c  2022-05-27 21:57:51.943739826 +0100
--- src/move.c  2022-06-16 11:37:57.844387882 +0100
***************
*** 1298,1304 ****
      int               row = 0;
      int               scol = 0, ccol = 0, ecol = 0;
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
      dict = rettv->vval.v_dict;
  
--- 1298,1304 ----
      int               row = 0;
      int               scol = 0, ccol = 0, ecol = 0;
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
      dict = rettv->vval.v_dict;
  
*** ../vim-8.2.5106/src/sign.c  2022-04-04 15:16:50.742014128 +0100
--- src/sign.c  2022-06-16 11:34:05.148772517 +0100
***************
*** 2335,2341 ****
      if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
      {
        // Define multiple signs
!       if (rettv_list_alloc(rettv) != OK)
            return;
  
        sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
--- 2335,2341 ----
      if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
      {
        // Define multiple signs
!       if (rettv_list_alloc(rettv) == FAIL)
            return;
  
        sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
***************
*** 2367,2373 ****
  {
      char_u    *name = NULL;
  
!     if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
--- 2367,2373 ----
  {
      char_u    *name = NULL;
  
!     if (rettv_list_alloc_id(rettv, aid_sign_getdefined) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
***************
*** 2393,2399 ****
      char_u    *group = NULL;
      int               notanum = FALSE;
  
!     if (rettv_list_alloc_id(rettv, aid_sign_getplaced) != OK)
        return;
  
      if (in_vim9script()
--- 2393,2399 ----
      char_u    *group = NULL;
      int               notanum = FALSE;
  
!     if (rettv_list_alloc_id(rettv, aid_sign_getplaced) == FAIL)
        return;
  
      if (in_vim9script()
***************
*** 2661,2667 ****
      listitem_T        *li;
      int               sign_id;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
--- 2661,2667 ----
      listitem_T        *li;
      int               sign_id;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
***************
*** 2721,2727 ****
      if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
      {
        // Undefine multiple signs
!       if (rettv_list_alloc(rettv) != OK)
            return;
  
        sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
--- 2721,2727 ----
      if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
      {
        // Undefine multiple signs
!       if (rettv_list_alloc(rettv) == FAIL)
            return;
  
        sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
***************
*** 2892,2898 ****
      listitem_T        *li;
      int               retval;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
--- 2892,2898 ----
      listitem_T        *li;
      int               retval;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
*** ../vim-8.2.5106/src/textprop.c      2022-05-24 21:26:33.816334785 +0100
--- src/textprop.c      2022-06-16 11:34:23.796739164 +0100
***************
*** 1076,1082 ****
                || check_for_opt_dict_arg(argvars, 1) == FAIL))
        return;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      // default: get text properties on current line
--- 1076,1082 ----
                || check_for_opt_dict_arg(argvars, 1) == FAIL))
        return;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      // default: get text properties on current line
*** ../vim-8.2.5106/src/term.c  2022-06-09 20:53:47.595378910 +0100
--- src/term.c  2022-06-16 11:38:56.628299822 +0100
***************
*** 1470,1476 ****
      int i;
  # endif
  
!     if (rettv_dict_alloc(rettv) != OK)
        return;
  # ifdef FEAT_TERMRESPONSE
      for (i = 0; i < TPR_COUNT; ++i)
--- 1470,1476 ----
      int i;
  # endif
  
!     if (rettv_dict_alloc(rettv) == FAIL)
        return;
  # ifdef FEAT_TERMRESPONSE
      for (i = 0; i < TPR_COUNT; ++i)
*** ../vim-8.2.5106/src/time.c  2022-05-06 14:58:59.534859061 +0100
--- src/time.c  2022-06-16 11:34:51.736690111 +0100
***************
*** 172,178 ****
      proftime_T        start;
      long      n1, n2;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script()
--- 172,178 ----
      proftime_T        start;
      long      n1, n2;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script()
***************
*** 787,793 ****
  {
      timer_T *timer = NULL;
  
!     if (rettv_list_alloc(rettv) != OK)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
--- 787,793 ----
  {
      timer_T *timer = NULL;
  
!     if (rettv_list_alloc(rettv) == FAIL)
        return;
  
      if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
*** ../vim-8.2.5106/src/version.c       2022-06-16 11:14:51.957291020 +0100
--- src/version.c       2022-06-16 11:39:41.600234433 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5107,
  /**/

-- 
FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing.

 /// 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/20220616104249.2E2901C2341%40moolenaar.net.

Raspunde prin e-mail lui