diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-13 18:51:13 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-13 19:29:25 -0700 |
commit | 6aae0e7c943267d2109ae20ec5086791c3b94a5e (patch) | |
tree | b0a8ec8985c5bdfb1882ee847ff64b42c98d3e0a | |
parent | 3344cffe7bf77c984550c01f9405f4d757150d8a (diff) | |
download | rneovim-6aae0e7c943267d2109ae20ec5086791c3b94a5e.tar.gz rneovim-6aae0e7c943267d2109ae20ec5086791c3b94a5e.tar.bz2 rneovim-6aae0e7c943267d2109ae20ec5086791c3b94a5e.zip |
lint
-rw-r--r-- | src/nvim/buffer.c | 3 | ||||
-rw-r--r-- | src/nvim/cursor_shape.c | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 56 | ||||
-rw-r--r-- | src/nvim/indent_c.c | 34 | ||||
-rw-r--r-- | src/nvim/menu.c | 10 | ||||
-rw-r--r-- | src/nvim/regexp.c | 23 | ||||
-rw-r--r-- | src/nvim/spell.c | 14 | ||||
-rw-r--r-- | src/nvim/spellfile.c | 22 | ||||
-rw-r--r-- | src/nvim/syntax.c | 4 | ||||
-rw-r--r-- | src/nvim/window.c | 10 |
11 files changed, 100 insertions, 82 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 7108742337..b50c764ac3 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1016,8 +1016,9 @@ do_bufdel( break; } arg = p; - } else + } else { bnr = getdigits_int(&arg, false, 0); + } } } if (!got_int && do_current diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 3b39b1cf21..3f06340611 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -177,7 +177,7 @@ char_u *parse_shape_opt(int what) if (!ascii_isdigit(*p)) return (char_u *)N_("E548: digit expected"); int n = getdigits_int(&p, false, 0); - if (len == 3) { /* "ver" or "hor" */ + if (len == 3) { // "ver" or "hor" if (n == 0) { return (char_u *)N_("E549: Illegal percentage"); } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 907bb590fd..00b9fcf646 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2936,9 +2936,9 @@ void ex_lockvar(exarg_T *eap) char_u *arg = eap->arg; int deep = 2; - if (eap->forceit) + if (eap->forceit) { deep = -1; - else if (ascii_isdigit(*arg)) { + } else if (ascii_isdigit(*arg)) { deep = getdigits_int(&arg, false, -1); arg = skipwhite(arg); } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 2a29450295..72d39adb3e 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2064,10 +2064,10 @@ static char_u * do_one_cmd(char_u **cmdlinep, } } - /* - * Check for a count. When accepting a BUFNAME, don't use "123foo" as a - * count, it's a buffer name. - */ + // + // Check for a count. When accepting a BUFNAME, don't use "123foo" as a + // count, it's a buffer name. + /// if ((ea.argt & COUNT) && ascii_isdigit(*ea.arg) && (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL || ascii_iswhite(*p))) { @@ -3796,14 +3796,16 @@ static linenr_T get_address(exarg_T *eap, break; default: - if (ascii_isdigit(*cmd)) /* absolute line number */ + if (ascii_isdigit(*cmd)) { // absolute line number lnum = getdigits_long(&cmd, false, 0); + } } for (;; ) { cmd = skipwhite(cmd); - if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) + if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) { break; + } if (lnum == MAXLNUM) { switch (addr_type) { @@ -7723,17 +7725,13 @@ static void ex_rundo(exarg_T *eap) u_read_undo((char *) eap->arg, hash, NULL); } -/* - * ":redo". - */ +/// ":redo". static void ex_redo(exarg_T *eap) { u_redo(1); } -/* - * ":earlier" and ":later". - */ +/// ":earlier" and ":later". static void ex_later(exarg_T *eap) { long count = 0; @@ -7741,9 +7739,9 @@ static void ex_later(exarg_T *eap) bool file = false; char_u *p = eap->arg; - if (*p == NUL) + if (*p == NUL) { count = 1; - else if (isdigit(*p)) { + } else if (isdigit(*p)) { count = getdigits_long(&p, false, 0); switch (*p) { case 's': ++p; sec = true; break; @@ -7754,11 +7752,12 @@ static void ex_later(exarg_T *eap) } } - if (*p != NUL) + if (*p != NUL) { EMSG2(_(e_invarg2), eap->arg); - else + } else { undo_time(eap->cmdidx == CMD_earlier ? -count : count, sec, file, false); + } } /* @@ -8412,23 +8411,24 @@ static void ex_findpat(exarg_T *eap) } n = 1; - if (ascii_isdigit(*eap->arg)) { /* get count */ + if (ascii_isdigit(*eap->arg)) { // get count n = getdigits_long(&eap->arg, false, 0); eap->arg = skipwhite(eap->arg); } - if (*eap->arg == '/') { /* Match regexp, not just whole words */ - whole = FALSE; - ++eap->arg; + if (*eap->arg == '/') { // Match regexp, not just whole words + whole = false; + eap->arg++; p = skip_regexp(eap->arg, '/', p_magic, NULL); if (*p) { *p++ = NUL; p = skipwhite(p); - /* Check for trailing illegal characters */ - if (!ends_excmd(*p)) + // Check for trailing illegal characters. + if (!ends_excmd(*p)) { eap->errmsg = e_trailing; - else + } else { eap->nextcmd = check_nextcmd(p); + } } } if (!eap->skip) @@ -8658,7 +8658,6 @@ eval_vars ( *errormsg = (char_u *)""; return NULL; } - } // // '#': Alternate file name // '%': Current file name @@ -8666,9 +8665,9 @@ eval_vars ( // File name for autocommand // and following modifiers // - else { + } else { switch (spec_idx) { - case SPEC_PERC: /* '%': current file */ + case SPEC_PERC: // '%': current file if (curbuf->b_fname == NULL) { result = (char_u *)""; valid = 0; // Must have ":p:h" to be valid @@ -8689,8 +8688,9 @@ eval_vars ( break; } s = src + 1; - if (*s == '<') /* "#<99" uses v:oldfiles */ - ++s; + if (*s == '<') { // "#<99" uses v:oldfiles. + s++; + } i = getdigits_int(&s, false, 0); if (s == src + 2 && src[1] == '-') { // just a minus sign, don't skip over it diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 955a8d3f5f..1ca1f3dae5 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1675,25 +1675,27 @@ void parse_cino(buf_T *buf) for (p = buf->b_p_cino; *p; ) { l = p++; - if (*p == '-') - ++p; - char_u *digits_start = p; /* remember where the digits start */ + if (*p == '-') { + p++; + } + char_u *digits_start = p; // remember where the digits start int n = getdigits_int(&p, true, 0); divider = 0; - if (*p == '.') { /* ".5s" means a fraction */ + if (*p == '.') { // ".5s" means a fraction. fraction = atoi((char *)++p); while (ascii_isdigit(*p)) { - ++p; - if (divider) + p++; + if (divider) { divider *= 10; - else + } else { divider = 10; + } } } - if (*p == 's') { /* "2s" means two times 'shiftwidth' */ - if (p == digits_start) - n = sw; /* just "s" is one 'shiftwidth' */ - else { + if (*p == 's') { // "2s" means two times 'shiftwidth'. + if (p == digits_start) { + n = sw; // just "s" is one 'shiftwidth'. + } else { n *= sw; if (divider) n += (sw * fraction + divider / 2) / divider; @@ -1910,15 +1912,15 @@ int get_c_indent(void) int what = 0; while (*p != NUL && *p != ':') { - if (*p == COM_START || *p == COM_END || *p == COM_MIDDLE) + if (*p == COM_START || *p == COM_END || *p == COM_MIDDLE) { what = *p++; - else if (*p == COM_LEFT || *p == COM_RIGHT) + } else if (*p == COM_LEFT || *p == COM_RIGHT) { align = *p++; - else if (ascii_isdigit(*p) || *p == '-') { + } else if (ascii_isdigit(*p) || *p == '-') { off = getdigits_int(&p, true, 0); + } else { + p++; } - else - ++p; } if (*p == ':') diff --git a/src/nvim/menu.c b/src/nvim/menu.c index a23dbb1701..18c4f1fff1 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -112,12 +112,14 @@ ex_menu(exarg_T *eap) } } if (ascii_iswhite(*p)) { - for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); ++i) { + for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); i++) { pri_tab[i] = getdigits_long(&arg, false, 0); - if (pri_tab[i] == 0) + if (pri_tab[i] == 0) { pri_tab[i] = 500; - if (*arg == '.') - ++arg; + } + if (*arg == '.') { + arg++; + } } arg = skipwhite(arg); } else if (eap->addr_count && eap->line2 != 0) { diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 97c410a647..9bc7ef07eb 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -3105,23 +3105,26 @@ static int read_limits(long *minval, long *maxval) long tmp; if (*regparse == '-') { - /* Starts with '-', so reverse the range later */ + // Starts with '-', so reverse the range later. regparse++; reverse = TRUE; } first_char = regparse; *minval = getdigits_long(®parse, false, 0); - if (*regparse == ',') { /* There is a comma */ - if (ascii_isdigit(*++regparse)) + if (*regparse == ',') { // There is a comma. + if (ascii_isdigit(*++regparse)) { *maxval = getdigits_long(®parse, false, MAX_LIMIT); - else + } else { *maxval = MAX_LIMIT; - } else if (ascii_isdigit(*first_char)) - *maxval = *minval; /* It was \{n} or \{-n} */ - else - *maxval = MAX_LIMIT; /* It was \{} or \{-} */ - if (*regparse == '\\') - regparse++; /* Allow either \{...} or \{...\} */ + } + } else if (ascii_isdigit(*first_char)) { + *maxval = *minval; // It was \{n} or \{-n} + } else { + *maxval = MAX_LIMIT; // It was \{} or \{-} + } + if (*regparse == '\\') { + regparse++; // Allow either \{...} or \{...\} + } if (*regparse != '}') { sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"), reg_magic == MAGIC_ALL ? "" : "\\"); diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 7152c3e451..724a0332bc 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2707,17 +2707,19 @@ int spell_check_sps(void) if (ascii_isdigit(*buf)) { s = buf; sps_limit = getdigits_int(&s, true, 0); - if (*s != NUL && !ascii_isdigit(*s)) + if (*s != NUL && !ascii_isdigit(*s)) { f = -1; - } else if (STRCMP(buf, "best") == 0) + } + } else if (STRCMP(buf, "best") == 0) { f = SPS_BEST; - else if (STRCMP(buf, "fast") == 0) + } else if (STRCMP(buf, "fast") == 0) { f = SPS_FAST; - else if (STRCMP(buf, "double") == 0) + } else if (STRCMP(buf, "double") == 0) { f = SPS_DOUBLE; - else if (STRNCMP(buf, "expr:", 5) != 0 - && STRNCMP(buf, "file:", 5) != 0) + } else if (STRNCMP(buf, "expr:", 5) != 0 + && STRNCMP(buf, "file:", 5) != 0) { f = -1; + } if (f == -1 || (sps_flags != 0 && f != 0)) { sps_flags = SPS_BEST; diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index c6b5dc500d..01daafa09e 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1834,23 +1834,29 @@ int spell_check_msm(void) return FAIL; // block count = (value * 1024) / SBLOCKSIZE (but avoid overflow) start = (getdigits_long(&p, true, 0) * 10) / (SBLOCKSIZE / 102); - if (*p != ',') + if (*p != ',') { return FAIL; - ++p; - if (!ascii_isdigit(*p)) + } + p++; + if (!ascii_isdigit(*p)) { return FAIL; + } incr = (getdigits_long(&p, true, 0) * 102) / (SBLOCKSIZE / 10); - if (*p != ',') + if (*p != ',') { return FAIL; - ++p; - if (!ascii_isdigit(*p)) + } + p++; + if (!ascii_isdigit(*p)) { return FAIL; + } added = getdigits_long(&p, true, 0) * 1024; - if (*p != NUL) + if (*p != NUL) { return FAIL; + } - if (start == 0 || incr == 0 || added == 0 || incr > start) + if (start == 0 || incr == 0 || added == 0 || incr > start) { return FAIL; + } compress_start = start; compress_inc = incr; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 80214feb7d..13fcad71fa 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5048,10 +5048,10 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci) } else { /* yy=x+99 */ end += 4; if (*end == '+') { - ++end; + end++; *p = getdigits_int(&end, true, 0); // positive offset } else if (*end == '-') { - ++end; + end++; *p = -getdigits_int(&end, true, 0); // negative offset } } diff --git a/src/nvim/window.c b/src/nvim/window.c index 3308abc395..1e6de73549 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5974,15 +5974,17 @@ file_name_in_line ( if (file_lnum != NULL) { char_u *p; - /* Get the number after the file name and a separator character */ + // Get the number after the file name and a separator character. p = ptr + len; p = skipwhite(p); if (*p != NUL) { - if (!isdigit(*p)) - ++p; /* skip the separator */ + if (!isdigit(*p)) { + p++; // skip the separator + } p = skipwhite(p); - if (isdigit(*p)) + if (isdigit(*p)) { *file_lnum = getdigits_long(&p, false, 0); + } } } |