From 003cda23123e98824ccc8f7467cf6800a8e75961 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 19 May 2021 20:45:57 -0400 Subject: vim-patch:8.2.2871: unnessary VIM_ISDIGIT() calls, badly indented code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Unnessary VIM_ISDIGIT() calls, badly indented code. Solution: Call skipdigits() on the next character. Improve indenting. (Dominique Pellé, closes vim/vim#8227) https://github.com/vim/vim/commit/4781d6fd8670af415c3b78f00d70036af85bd286 --- src/nvim/ex_docmd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/nvim/ex_docmd.c') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c557bb2438..c93f9fe6f2 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1772,7 +1772,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, // count, it's a buffer name. /// if ((ea.argt & EX_COUNT) && ascii_isdigit(*ea.arg) - && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg)) == NUL + && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL || ascii_iswhite(*p))) { n = getdigits_long(&ea.arg, false, -1); ea.arg = skipwhite(ea.arg); @@ -2790,15 +2790,18 @@ static struct cmdmod { */ int modifier_len(char_u *cmd) { - int i, j; char_u *p = cmd; - if (ascii_isdigit(*cmd)) - p = skipwhite(skipdigits(cmd)); - for (i = 0; i < (int)ARRAY_SIZE(cmdmods); ++i) { - for (j = 0; p[j] != NUL; ++j) - if (p[j] != cmdmods[i].name[j]) + if (ascii_isdigit(*cmd)) { + p = skipwhite(skipdigits(cmd + 1)); + } + for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) { + int j; + for (j = 0; p[j] != NUL; j++) { + if (p[j] != cmdmods[i].name[j]) { break; + } + } if (j >= cmdmods[i].minlen && !ASCII_ISALPHA(p[j]) && (p == cmd || cmdmods[i].has_count)) { -- cgit