From 1f75184b5cd4db7c250b1eb4d39ea06d3c906e5f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 23 Feb 2024 06:37:19 +0800 Subject: [PATCH] vim-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: vim/vim#14075 https://github.com/vim/vim/commit/5e3674b42da10b7e7c72d1f20f9a15379af1b60a --- src/nvim/eval/funcs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index b679b64bf6..2e2640604b 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2874,7 +2874,7 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) p2 = p; } - oparg_T oap; + oparg_T oa; bool inclusive = true; if (region_type == kMTCharWise) { @@ -2902,16 +2902,16 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) colnr_T sc1, ec1, sc2, ec2; getvvcol(curwin, &p1, &sc1, NULL, &ec1); getvvcol(curwin, &p2, &sc2, NULL, &ec2); - oap.motion_type = kMTBlockWise; - oap.inclusive = true; - oap.op_type = OP_NOP; - oap.start = p1; - oap.end = p2; - oap.start_vcol = MIN(sc1, sc2); + oa.motion_type = kMTBlockWise; + 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); } } @@ -2928,7 +2928,7 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) akt = xstrdup(ml_get(lnum)); } else if (region_type == kMTBlockWise) { struct block_def bd; - block_prep(&oap, &bd, lnum, false); + block_prep(&oa, &bd, lnum, false); akt = block_def2str(&bd); } else if (p1.lnum < lnum && lnum < p2.lnum) { akt = xstrdup(ml_get(lnum));