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;
|
break;
|
||||||
}
|
}
|
||||||
arg = p;
|
arg = p;
|
||||||
} else
|
} else {
|
||||||
bnr = getdigits_int(&arg, false, 0);
|
bnr = getdigits_int(&arg, false, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!got_int && do_current
|
if (!got_int && do_current
|
||||||
|
@ -177,7 +177,7 @@ char_u *parse_shape_opt(int what)
|
|||||||
if (!ascii_isdigit(*p))
|
if (!ascii_isdigit(*p))
|
||||||
return (char_u *)N_("E548: digit expected");
|
return (char_u *)N_("E548: digit expected");
|
||||||
int n = getdigits_int(&p, false, 0);
|
int n = getdigits_int(&p, false, 0);
|
||||||
if (len == 3) { /* "ver" or "hor" */
|
if (len == 3) { // "ver" or "hor"
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return (char_u *)N_("E549: Illegal percentage");
|
return (char_u *)N_("E549: Illegal percentage");
|
||||||
}
|
}
|
||||||
|
@ -2936,9 +2936,9 @@ void ex_lockvar(exarg_T *eap)
|
|||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
int deep = 2;
|
int deep = 2;
|
||||||
|
|
||||||
if (eap->forceit)
|
if (eap->forceit) {
|
||||||
deep = -1;
|
deep = -1;
|
||||||
else if (ascii_isdigit(*arg)) {
|
} else if (ascii_isdigit(*arg)) {
|
||||||
deep = getdigits_int(&arg, false, -1);
|
deep = getdigits_int(&arg, false, -1);
|
||||||
arg = skipwhite(arg);
|
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
|
// Check for a count. When accepting a BUFNAME, don't use "123foo" as a
|
||||||
* count, it's a buffer name.
|
// count, it's a buffer name.
|
||||||
*/
|
///
|
||||||
if ((ea.argt & COUNT) && ascii_isdigit(*ea.arg)
|
if ((ea.argt & COUNT) && ascii_isdigit(*ea.arg)
|
||||||
&& (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|
&& (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|
||||||
|| ascii_iswhite(*p))) {
|
|| ascii_iswhite(*p))) {
|
||||||
@ -3796,14 +3796,16 @@ static linenr_T get_address(exarg_T *eap,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (ascii_isdigit(*cmd)) /* absolute line number */
|
if (ascii_isdigit(*cmd)) { // absolute line number
|
||||||
lnum = getdigits_long(&cmd, false, 0);
|
lnum = getdigits_long(&cmd, false, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
cmd = skipwhite(cmd);
|
cmd = skipwhite(cmd);
|
||||||
if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd))
|
if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (lnum == MAXLNUM) {
|
if (lnum == MAXLNUM) {
|
||||||
switch (addr_type) {
|
switch (addr_type) {
|
||||||
@ -7723,17 +7725,13 @@ static void ex_rundo(exarg_T *eap)
|
|||||||
u_read_undo((char *) eap->arg, hash, NULL);
|
u_read_undo((char *) eap->arg, hash, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// ":redo".
|
||||||
* ":redo".
|
|
||||||
*/
|
|
||||||
static void ex_redo(exarg_T *eap)
|
static void ex_redo(exarg_T *eap)
|
||||||
{
|
{
|
||||||
u_redo(1);
|
u_redo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// ":earlier" and ":later".
|
||||||
* ":earlier" and ":later".
|
|
||||||
*/
|
|
||||||
static void ex_later(exarg_T *eap)
|
static void ex_later(exarg_T *eap)
|
||||||
{
|
{
|
||||||
long count = 0;
|
long count = 0;
|
||||||
@ -7741,9 +7739,9 @@ static void ex_later(exarg_T *eap)
|
|||||||
bool file = false;
|
bool file = false;
|
||||||
char_u *p = eap->arg;
|
char_u *p = eap->arg;
|
||||||
|
|
||||||
if (*p == NUL)
|
if (*p == NUL) {
|
||||||
count = 1;
|
count = 1;
|
||||||
else if (isdigit(*p)) {
|
} else if (isdigit(*p)) {
|
||||||
count = getdigits_long(&p, false, 0);
|
count = getdigits_long(&p, false, 0);
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 's': ++p; sec = true; break;
|
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);
|
EMSG2(_(e_invarg2), eap->arg);
|
||||||
else
|
} else {
|
||||||
undo_time(eap->cmdidx == CMD_earlier ? -count : count,
|
undo_time(eap->cmdidx == CMD_earlier ? -count : count,
|
||||||
sec, file, false);
|
sec, file, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -8412,23 +8411,24 @@ static void ex_findpat(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
n = 1;
|
n = 1;
|
||||||
if (ascii_isdigit(*eap->arg)) { /* get count */
|
if (ascii_isdigit(*eap->arg)) { // get count
|
||||||
n = getdigits_long(&eap->arg, false, 0);
|
n = getdigits_long(&eap->arg, false, 0);
|
||||||
eap->arg = skipwhite(eap->arg);
|
eap->arg = skipwhite(eap->arg);
|
||||||
}
|
}
|
||||||
if (*eap->arg == '/') { /* Match regexp, not just whole words */
|
if (*eap->arg == '/') { // Match regexp, not just whole words
|
||||||
whole = FALSE;
|
whole = false;
|
||||||
++eap->arg;
|
eap->arg++;
|
||||||
p = skip_regexp(eap->arg, '/', p_magic, NULL);
|
p = skip_regexp(eap->arg, '/', p_magic, NULL);
|
||||||
if (*p) {
|
if (*p) {
|
||||||
*p++ = NUL;
|
*p++ = NUL;
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
|
|
||||||
/* Check for trailing illegal characters */
|
// Check for trailing illegal characters.
|
||||||
if (!ends_excmd(*p))
|
if (!ends_excmd(*p)) {
|
||||||
eap->errmsg = e_trailing;
|
eap->errmsg = e_trailing;
|
||||||
else
|
} else {
|
||||||
eap->nextcmd = check_nextcmd(p);
|
eap->nextcmd = check_nextcmd(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!eap->skip)
|
if (!eap->skip)
|
||||||
@ -8658,7 +8658,6 @@ eval_vars (
|
|||||||
*errormsg = (char_u *)"";
|
*errormsg = (char_u *)"";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// '#': Alternate file name
|
// '#': Alternate file name
|
||||||
// '%': Current file name
|
// '%': Current file name
|
||||||
@ -8666,9 +8665,9 @@ eval_vars (
|
|||||||
// File name for autocommand
|
// File name for autocommand
|
||||||
// and following modifiers
|
// and following modifiers
|
||||||
//
|
//
|
||||||
else {
|
} else {
|
||||||
switch (spec_idx) {
|
switch (spec_idx) {
|
||||||
case SPEC_PERC: /* '%': current file */
|
case SPEC_PERC: // '%': current file
|
||||||
if (curbuf->b_fname == NULL) {
|
if (curbuf->b_fname == NULL) {
|
||||||
result = (char_u *)"";
|
result = (char_u *)"";
|
||||||
valid = 0; // Must have ":p:h" to be valid
|
valid = 0; // Must have ":p:h" to be valid
|
||||||
@ -8689,8 +8688,9 @@ eval_vars (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s = src + 1;
|
s = src + 1;
|
||||||
if (*s == '<') /* "#<99" uses v:oldfiles */
|
if (*s == '<') { // "#<99" uses v:oldfiles.
|
||||||
++s;
|
s++;
|
||||||
|
}
|
||||||
i = getdigits_int(&s, false, 0);
|
i = getdigits_int(&s, false, 0);
|
||||||
if (s == src + 2 && src[1] == '-') {
|
if (s == src + 2 && src[1] == '-') {
|
||||||
// just a minus sign, don't skip over it
|
// 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; ) {
|
for (p = buf->b_p_cino; *p; ) {
|
||||||
l = p++;
|
l = p++;
|
||||||
if (*p == '-')
|
if (*p == '-') {
|
||||||
++p;
|
p++;
|
||||||
char_u *digits_start = p; /* remember where the digits start */
|
}
|
||||||
|
char_u *digits_start = p; // remember where the digits start
|
||||||
int n = getdigits_int(&p, true, 0);
|
int n = getdigits_int(&p, true, 0);
|
||||||
divider = 0;
|
divider = 0;
|
||||||
if (*p == '.') { /* ".5s" means a fraction */
|
if (*p == '.') { // ".5s" means a fraction.
|
||||||
fraction = atoi((char *)++p);
|
fraction = atoi((char *)++p);
|
||||||
while (ascii_isdigit(*p)) {
|
while (ascii_isdigit(*p)) {
|
||||||
++p;
|
p++;
|
||||||
if (divider)
|
if (divider) {
|
||||||
divider *= 10;
|
divider *= 10;
|
||||||
else
|
} else {
|
||||||
divider = 10;
|
divider = 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*p == 's') { /* "2s" means two times 'shiftwidth' */
|
if (*p == 's') { // "2s" means two times 'shiftwidth'.
|
||||||
if (p == digits_start)
|
if (p == digits_start) {
|
||||||
n = sw; /* just "s" is one 'shiftwidth' */
|
n = sw; // just "s" is one 'shiftwidth'.
|
||||||
else {
|
} else {
|
||||||
n *= sw;
|
n *= sw;
|
||||||
if (divider)
|
if (divider)
|
||||||
n += (sw * fraction + divider / 2) / divider;
|
n += (sw * fraction + divider / 2) / divider;
|
||||||
@ -1910,15 +1912,15 @@ int get_c_indent(void)
|
|||||||
int what = 0;
|
int what = 0;
|
||||||
|
|
||||||
while (*p != NUL && *p != ':') {
|
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++;
|
what = *p++;
|
||||||
else if (*p == COM_LEFT || *p == COM_RIGHT)
|
} else if (*p == COM_LEFT || *p == COM_RIGHT) {
|
||||||
align = *p++;
|
align = *p++;
|
||||||
else if (ascii_isdigit(*p) || *p == '-') {
|
} else if (ascii_isdigit(*p) || *p == '-') {
|
||||||
off = getdigits_int(&p, true, 0);
|
off = getdigits_int(&p, true, 0);
|
||||||
|
} else {
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
++p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p == ':')
|
if (*p == ':')
|
||||||
|
@ -112,12 +112,14 @@ ex_menu(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ascii_iswhite(*p)) {
|
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);
|
pri_tab[i] = getdigits_long(&arg, false, 0);
|
||||||
if (pri_tab[i] == 0)
|
if (pri_tab[i] == 0) {
|
||||||
pri_tab[i] = 500;
|
pri_tab[i] = 500;
|
||||||
if (*arg == '.')
|
}
|
||||||
++arg;
|
if (*arg == '.') {
|
||||||
|
arg++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
arg = skipwhite(arg);
|
arg = skipwhite(arg);
|
||||||
} else if (eap->addr_count && eap->line2 != 0) {
|
} else if (eap->addr_count && eap->line2 != 0) {
|
||||||
|
@ -3105,23 +3105,26 @@ static int read_limits(long *minval, long *maxval)
|
|||||||
long tmp;
|
long tmp;
|
||||||
|
|
||||||
if (*regparse == '-') {
|
if (*regparse == '-') {
|
||||||
/* Starts with '-', so reverse the range later */
|
// Starts with '-', so reverse the range later.
|
||||||
regparse++;
|
regparse++;
|
||||||
reverse = TRUE;
|
reverse = TRUE;
|
||||||
}
|
}
|
||||||
first_char = regparse;
|
first_char = regparse;
|
||||||
*minval = getdigits_long(®parse, false, 0);
|
*minval = getdigits_long(®parse, false, 0);
|
||||||
if (*regparse == ',') { /* There is a comma */
|
if (*regparse == ',') { // There is a comma.
|
||||||
if (ascii_isdigit(*++regparse))
|
if (ascii_isdigit(*++regparse)) {
|
||||||
*maxval = getdigits_long(®parse, false, MAX_LIMIT);
|
*maxval = getdigits_long(®parse, false, MAX_LIMIT);
|
||||||
else
|
} else {
|
||||||
*maxval = MAX_LIMIT;
|
*maxval = MAX_LIMIT;
|
||||||
} else if (ascii_isdigit(*first_char))
|
}
|
||||||
*maxval = *minval; /* It was \{n} or \{-n} */
|
} else if (ascii_isdigit(*first_char)) {
|
||||||
else
|
*maxval = *minval; // It was \{n} or \{-n}
|
||||||
*maxval = MAX_LIMIT; /* It was \{} or \{-} */
|
} else {
|
||||||
if (*regparse == '\\')
|
*maxval = MAX_LIMIT; // It was \{} or \{-}
|
||||||
regparse++; /* Allow either \{...} or \{...\} */
|
}
|
||||||
|
if (*regparse == '\\') {
|
||||||
|
regparse++; // Allow either \{...} or \{...\}
|
||||||
|
}
|
||||||
if (*regparse != '}') {
|
if (*regparse != '}') {
|
||||||
sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"),
|
sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"),
|
||||||
reg_magic == MAGIC_ALL ? "" : "\\");
|
reg_magic == MAGIC_ALL ? "" : "\\");
|
||||||
|
@ -2707,17 +2707,19 @@ int spell_check_sps(void)
|
|||||||
if (ascii_isdigit(*buf)) {
|
if (ascii_isdigit(*buf)) {
|
||||||
s = buf;
|
s = buf;
|
||||||
sps_limit = getdigits_int(&s, true, 0);
|
sps_limit = getdigits_int(&s, true, 0);
|
||||||
if (*s != NUL && !ascii_isdigit(*s))
|
if (*s != NUL && !ascii_isdigit(*s)) {
|
||||||
f = -1;
|
f = -1;
|
||||||
} else if (STRCMP(buf, "best") == 0)
|
}
|
||||||
|
} else if (STRCMP(buf, "best") == 0) {
|
||||||
f = SPS_BEST;
|
f = SPS_BEST;
|
||||||
else if (STRCMP(buf, "fast") == 0)
|
} else if (STRCMP(buf, "fast") == 0) {
|
||||||
f = SPS_FAST;
|
f = SPS_FAST;
|
||||||
else if (STRCMP(buf, "double") == 0)
|
} else if (STRCMP(buf, "double") == 0) {
|
||||||
f = SPS_DOUBLE;
|
f = SPS_DOUBLE;
|
||||||
else if (STRNCMP(buf, "expr:", 5) != 0
|
} else if (STRNCMP(buf, "expr:", 5) != 0
|
||||||
&& STRNCMP(buf, "file:", 5) != 0)
|
&& STRNCMP(buf, "file:", 5) != 0) {
|
||||||
f = -1;
|
f = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (f == -1 || (sps_flags != 0 && f != 0)) {
|
if (f == -1 || (sps_flags != 0 && f != 0)) {
|
||||||
sps_flags = SPS_BEST;
|
sps_flags = SPS_BEST;
|
||||||
|
@ -1834,23 +1834,29 @@ int spell_check_msm(void)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
// block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
|
// block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
|
||||||
start = (getdigits_long(&p, true, 0) * 10) / (SBLOCKSIZE / 102);
|
start = (getdigits_long(&p, true, 0) * 10) / (SBLOCKSIZE / 102);
|
||||||
if (*p != ',')
|
if (*p != ',') {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
++p;
|
}
|
||||||
if (!ascii_isdigit(*p))
|
p++;
|
||||||
|
if (!ascii_isdigit(*p)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
incr = (getdigits_long(&p, true, 0) * 102) / (SBLOCKSIZE / 10);
|
incr = (getdigits_long(&p, true, 0) * 102) / (SBLOCKSIZE / 10);
|
||||||
if (*p != ',')
|
if (*p != ',') {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
++p;
|
}
|
||||||
if (!ascii_isdigit(*p))
|
p++;
|
||||||
|
if (!ascii_isdigit(*p)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
added = getdigits_long(&p, true, 0) * 1024;
|
added = getdigits_long(&p, true, 0) * 1024;
|
||||||
if (*p != NUL)
|
if (*p != NUL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (start == 0 || incr == 0 || added == 0 || incr > start)
|
if (start == 0 || incr == 0 || added == 0 || incr > start) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
compress_start = start;
|
compress_start = start;
|
||||||
compress_inc = incr;
|
compress_inc = incr;
|
||||||
|
@ -5048,10 +5048,10 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
|
|||||||
} else { /* yy=x+99 */
|
} else { /* yy=x+99 */
|
||||||
end += 4;
|
end += 4;
|
||||||
if (*end == '+') {
|
if (*end == '+') {
|
||||||
++end;
|
end++;
|
||||||
*p = getdigits_int(&end, true, 0); // positive offset
|
*p = getdigits_int(&end, true, 0); // positive offset
|
||||||
} else if (*end == '-') {
|
} else if (*end == '-') {
|
||||||
++end;
|
end++;
|
||||||
*p = -getdigits_int(&end, true, 0); // negative offset
|
*p = -getdigits_int(&end, true, 0); // negative offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5974,15 +5974,17 @@ file_name_in_line (
|
|||||||
if (file_lnum != NULL) {
|
if (file_lnum != NULL) {
|
||||||
char_u *p;
|
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 = ptr + len;
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
if (*p != NUL) {
|
if (*p != NUL) {
|
||||||
if (!isdigit(*p))
|
if (!isdigit(*p)) {
|
||||||
++p; /* skip the separator */
|
p++; // skip the separator
|
||||||
|
}
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
if (isdigit(*p))
|
if (isdigit(*p)) {
|
||||||
*file_lnum = getdigits_long(&p, false, 0);
|
*file_lnum = getdigits_long(&p, false, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user