mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lint
This commit is contained in:
parent
3344cffe7b
commit
6aae0e7c94
@ -1016,8 +1016,9 @@ do_bufdel(
|
||||
break;
|
||||
}
|
||||
arg = p;
|
||||
} else
|
||||
} else {
|
||||
bnr = getdigits_int(&arg, false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!got_int && do_current
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 == ':')
|
||||
|
@ -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) {
|
||||
|
@ -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 ? "" : "\\");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user