]> granicus.if.org Git - vim/commitdiff
patch 8.2.2871: unnessary VIM_ISDIGIT() calls, badly indented code v8.2.2871
authorDominique Pelle <dominique.pelle@gmail.com>
Tue, 18 May 2021 19:46:31 +0000 (21:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 18 May 2021 19:46:31 +0000 (21:46 +0200)
Problem:    Unnessary VIM_ISDIGIT() calls, badly indented code.
Solution:   Call skipdigits() on the next character.  Improve indenting.
            (Dominique PellĂ©, closes #8227)

src/charset.c
src/evalfunc.c
src/ex_docmd.c
src/json.c
src/ops.c
src/tag.c
src/version.c
src/vim9compile.c

index 10aa2e8e52541dce34df70577cbe5d0ff36256c3..fcaeedf75770b014bc9b18c8daf1c0c92354a3c1 100644 (file)
@@ -169,8 +169,7 @@ buf_init_chartab(
            }
            if (VIM_ISDIGIT(*p))
                c = getdigits(&p);
-           else
-                if (has_mbyte)
+           else if (has_mbyte)
                c = mb_ptr2char_adv(&p);
            else
                c = *p++;
@@ -180,8 +179,7 @@ buf_init_chartab(
                ++p;
                if (VIM_ISDIGIT(*p))
                    c2 = getdigits(&p);
-               else
-                    if (has_mbyte)
+               else if (has_mbyte)
                    c2 = mb_ptr2char_adv(&p);
                else
                    c2 = *p++;
index e740f91b1332a584e1fbdec9a2d18adf70a74e32..16447aba25b636ab992c961ecdf3ce9908ee2f97 100644 (file)
@@ -9674,9 +9674,9 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
        else
 #endif
            if (t_colors > 1)
-           modec = 'c';
-       else
-           modec = 't';
+               modec = 'c';
+           else
+               modec = 't';
     }
 
     switch (TOLOWER_ASC(what[0]))
index 7811c8f7f30d124c304e14c7754e9ad01290df12..2738f4f4d18e56ff74773b2e070e9fb16da37987 100644 (file)
@@ -2384,7 +2384,7 @@ do_one_cmd(
      * count, it's a buffer name.
      */
     if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg)
-           && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
+           && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL
                                                          || VIM_ISWHITE(*p)))
     {
        n = getdigits(&ea.arg);
@@ -3730,7 +3730,7 @@ modifier_len(char_u *cmd)
     char_u     *p = cmd;
 
     if (VIM_ISDIGIT(*cmd))
-       p = skipwhite(skipdigits(cmd));
+       p = skipwhite(skipdigits(cmd + 1));
     for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
     {
        for (j = 0; p[j] != NUL; ++j)
index 25349b7551415ed52f07540521eb352a3ac90ded..db25b70cc40082b540315104043043d3d42fcc46 100644 (file)
@@ -607,7 +607,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
     cur_item = res;
     init_tv(&item);
     if (res != NULL)
-    init_tv(res);
+       init_tv(res);
 
     fill_numbuflen(reader);
     p = reader->js_buf + reader->js_used;
index d8e96ff1a46ad407a8919e9f1ced12632d62b2b6..e4590a1e75720d31fbe50ddddd77968dc29dfd2e 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -3985,12 +3985,13 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
                op_formatexpr(oap);     // use expression
            else
 #endif
+           {
                if (*p_fp != NUL || *curbuf->b_p_fp != NUL)
-               op_colon(oap);          // use external command
-           else
-               op_format(oap, FALSE);  // use internal function
+                   op_colon(oap);              // use external command
+               else
+                   op_format(oap, FALSE);      // use internal function
+           }
            break;
-
        case OP_FORMAT2:
            op_format(oap, TRUE);       // use internal function
            break;
index 4eb7a4f434f876305e7b828f1f8855d5151a2a33..256f885c82c4fd895d7a19ca3544a91048a2f828 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -3824,7 +3824,7 @@ find_extra(char_u **pp)
     for (;;)
     {
        if (VIM_ISDIGIT(*str))
-           str = skipdigits(str);
+           str = skipdigits(str + 1);
        else if (*str == '/' || *str == '?')
        {
            str = skip_regexp(str + 1, *str, FALSE);
index edc95e56103ccd5a91d56c1b5f04cbc885131552..8d73f68c09973052cf30e7ba2084ddcb1bc48a82 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2871,
 /**/
     2870,
 /**/
index 160c8e428f97226b74a617e899a5f53907d74f4a..5e912dd8816c8c81f54f26613285fdcd18294c03 100644 (file)
@@ -8341,11 +8341,11 @@ compile_endtry(char_u *arg, cctx_T *cctx)
        }
 
 #ifdef FEAT_PROFILE
-    if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
-                                                  .isn_type == ISN_PROF_START)
-       // move the profile start after "endtry" so that it's not counted when
-       // the exception is rethrown.
-       --instr->ga_len;
+       if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
+                                               .isn_type == ISN_PROF_START)
+           // move the profile start after "endtry" so that it's not counted when
+           // the exception is rethrown.
+           --instr->ga_len;
 #endif
 
        // Fill in the "end" label in jumps at the end of the blocks, if not