patch 9.1.0127: Naming a non-pointer variable "oap" is strange Commit: https://github.com/vim/vim/commit/5e3674b42da10b7e7c72d1f20f9a15379af1b60a Author: zeertzjq <zeert...@outlook.com> Date: Thu Feb 22 19:51:34 2024 +0100
patch 9.1.0127: Naming a non-pointer variable "oap" is strange Problem: Naming a non-pointer variable "oap" is strange. Solution: Rename it to "oa". Also prevent using freed memory in case of memory allocation failure. (zeertzjq) closes: #14075 Signed-off-by: zeertzjq <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/evalfunc.c b/src/evalfunc.c index 981f8abed..37010d7ba 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5485,7 +5485,7 @@ block_def2str(struct block_def *bd) f_getregion(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - oparg_T oap; + oparg_T oa; struct block_def bd; char_u *akt = NULL; int inclusive = TRUE; @@ -5584,16 +5584,16 @@ f_getregion(typval_T *argvars, typval_T *rettv) getvvcol(curwin, &p1, &sc1, NULL, &ec1); getvvcol(curwin, &p2, &sc2, NULL, &ec2); - oap.motion_type = MBLOCK; - oap.inclusive = TRUE; - oap.op_type = OP_NOP; - oap.start = p1; - oap.end = p2; - oap.start_vcol = MIN(sc1, sc2); + oa.motion_type = MBLOCK; + oa.inclusive = TRUE; + oa.op_type = OP_NOP; + oa.start = p1; + oa.end = p2; + oa.start_vcol = MIN(sc1, sc2); if (*p_sel == 'e' && ec1 < sc2 && 0 < sc2 && ec2 > ec1) - oap.end_vcol = sc2 - 1; + oa.end_vcol = sc2 - 1; else - oap.end_vcol = MAX(ec1, ec2); + oa.end_vcol = MAX(ec1, ec2); } // Include the trailing byte of a multi-byte char. @@ -5609,7 +5609,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) akt = vim_strsave(ml_get(lnum)); else if (region_type == MBLOCK) { - block_prep(&oap, &bd, lnum, FALSE); + block_prep(&oa, &bd, lnum, FALSE); akt = block_def2str(&bd); } else if (p1.lnum < lnum && lnum < p2.lnum) @@ -5628,7 +5628,8 @@ f_getregion(typval_T *argvars, typval_T *rettv) if (akt == NULL || ret == FAIL) { - list_free(rettv->vval.v_list); + clear_tv(rettv); + (void)rettv_list_alloc(rettv); break; } } diff --git a/src/version.c b/src/version.c index b8e79dd54..e2d1f591a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 127, /**/ 126, /**/ -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1rdEIh-00Cwe4-7v%40256bit.org.