To: vim_dev@googlegroups.com Subject: Patch 8.2.2871 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2871 Problem: Unnessary VIM_ISDIGIT() calls, badly indented code. Solution: Call skipdigits() on the next character. Improve indenting. (Dominique Pellé, closes #8227) Files: src/charset.c, src/evalfunc.c, src/ex_docmd.c, src/json.c, src/ops.c, src/tag.c, src/vim9compile.c *** ../vim-8.2.2870/src/charset.c 2021-04-06 20:21:55.299147728 +0200 --- src/charset.c 2021-05-18 21:41:52.654186398 +0200 *************** *** 169,176 **** } if (VIM_ISDIGIT(*p)) c = getdigits(&p); ! else ! if (has_mbyte) c = mb_ptr2char_adv(&p); else c = *p++; --- 169,175 ---- } if (VIM_ISDIGIT(*p)) c = getdigits(&p); ! else if (has_mbyte) c = mb_ptr2char_adv(&p); else c = *p++; *************** *** 180,187 **** ++p; if (VIM_ISDIGIT(*p)) c2 = getdigits(&p); ! else ! if (has_mbyte) c2 = mb_ptr2char_adv(&p); else c2 = *p++; --- 179,185 ---- ++p; if (VIM_ISDIGIT(*p)) c2 = getdigits(&p); ! else if (has_mbyte) c2 = mb_ptr2char_adv(&p); else c2 = *p++; *** ../vim-8.2.2870/src/evalfunc.c 2021-05-13 14:55:51.620360842 +0200 --- src/evalfunc.c 2021-05-18 21:41:52.654186398 +0200 *************** *** 9674,9682 **** else #endif if (t_colors > 1) ! modec = 'c'; ! else ! modec = 't'; } switch (TOLOWER_ASC(what[0])) --- 9674,9682 ---- else #endif if (t_colors > 1) ! modec = 'c'; ! else ! modec = 't'; } switch (TOLOWER_ASC(what[0])) *** ../vim-8.2.2870/src/ex_docmd.c 2021-04-28 20:40:39.799852470 +0200 --- src/ex_docmd.c 2021-05-18 21:41:52.658186380 +0200 *************** *** 2384,2390 **** * count, it's a buffer name. */ if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg) ! && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg)) == NUL || VIM_ISWHITE(*p))) { n = getdigits(&ea.arg); --- 2384,2390 ---- * count, it's a buffer name. */ if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg) ! && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL || VIM_ISWHITE(*p))) { n = getdigits(&ea.arg); *************** *** 3730,3736 **** char_u *p = cmd; if (VIM_ISDIGIT(*cmd)) ! p = skipwhite(skipdigits(cmd)); for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i) { for (j = 0; p[j] != NUL; ++j) --- 3730,3736 ---- char_u *p = cmd; if (VIM_ISDIGIT(*cmd)) ! p = skipwhite(skipdigits(cmd + 1)); for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i) { for (j = 0; p[j] != NUL; ++j) *** ../vim-8.2.2870/src/json.c 2021-05-07 17:55:51.979584412 +0200 --- src/json.c 2021-05-18 21:41:52.658186380 +0200 *************** *** 607,613 **** cur_item = res; init_tv(&item); if (res != NULL) ! init_tv(res); fill_numbuflen(reader); p = reader->js_buf + reader->js_used; --- 607,613 ---- cur_item = res; init_tv(&item); if (res != NULL) ! init_tv(res); fill_numbuflen(reader); p = reader->js_buf + reader->js_used; *** ../vim-8.2.2870/src/ops.c 2020-12-22 17:59:28.067057967 +0100 --- src/ops.c 2021-05-18 21:41:52.658186380 +0200 *************** *** 3985,3996 **** 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 break; - case OP_FORMAT2: op_format(oap, TRUE); // use internal function break; --- 3985,3997 ---- 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 ! } break; case OP_FORMAT2: op_format(oap, TRUE); // use internal function break; *** ../vim-8.2.2870/src/tag.c 2021-05-05 22:51:35.631336525 +0200 --- src/tag.c 2021-05-18 21:41:52.658186380 +0200 *************** *** 3824,3830 **** for (;;) { if (VIM_ISDIGIT(*str)) ! str = skipdigits(str); else if (*str == '/' || *str == '?') { str = skip_regexp(str + 1, *str, FALSE); --- 3824,3830 ---- for (;;) { if (VIM_ISDIGIT(*str)) ! str = skipdigits(str + 1); else if (*str == '/' || *str == '?') { str = skip_regexp(str + 1, *str, FALSE); *** ../vim-8.2.2870/src/vim9compile.c 2021-05-17 00:01:38.803009279 +0200 --- src/vim9compile.c 2021-05-18 21:41:52.658186380 +0200 *************** *** 8341,8351 **** } #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; #endif // Fill in the "end" label in jumps at the end of the blocks, if not --- 8341,8351 ---- } #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; #endif // Fill in the "end" label in jumps at the end of the blocks, if not *** ../vim-8.2.2870/src/version.c 2021-05-18 21:38:41.931029807 +0200 --- src/version.c 2021-05-18 21:46:12.713028289 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2871, /**/ -- CONCORDE: Message for you, sir. He falls forward revealing the arrow with the note. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///