aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2015-04-22 19:47:53 -0300
committerFelipe Oliveira Carvalho <felipekde@gmail.com>2015-04-24 20:37:13 -0300
commitcaabcae0b7470731e793c199b905bfa1bb696914 (patch)
tree2015066852ad22ec24353db40d2dc752ccd59ce3 /src
parent93bf201119f68b0723ee3f240afa48134cc41399 (diff)
downloadrneovim-caabcae0b7470731e793c199b905bfa1bb696914.tar.gz
rneovim-caabcae0b7470731e793c199b905bfa1bb696914.tar.bz2
rneovim-caabcae0b7470731e793c199b905bfa1bb696914.zip
Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.h
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ascii.h10
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/charset.c25
-rw-r--r--src/nvim/cursor_shape.c2
-rw-r--r--src/nvim/diff.c6
-rw-r--r--src/nvim/digraph.c2
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/eval.c20
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_cmds2.c6
-rw-r--r--src/nvim/ex_docmd.c28
-rw-r--r--src/nvim/ex_eval.c12
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/farsi.c2
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/fold.c8
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/hardcopy.c4
-rw-r--r--src/nvim/if_cscope.c4
-rw-r--r--src/nvim/indent_c.c6
-rw-r--r--src/nvim/keymap.c4
-rw-r--r--src/nvim/macros.h7
-rw-r--r--src/nvim/main.c8
-rw-r--r--src/nvim/mark.c12
-rw-r--r--src/nvim/menu.c4
-rw-r--r--src/nvim/message.c12
-rw-r--r--src/nvim/misc1.c4
-rw-r--r--src/nvim/normal.c6
-rw-r--r--src/nvim/ops.c8
-rw-r--r--src/nvim/option.c34
-rw-r--r--src/nvim/regexp.c26
-rw-r--r--src/nvim/regexp_nfa.c12
-rw-r--r--src/nvim/screen.c2
-rw-r--r--src/nvim/search.c8
-rw-r--r--src/nvim/spell.c24
-rw-r--r--src/nvim/syntax.c4
-rw-r--r--src/nvim/tag.c4
37 files changed, 168 insertions, 176 deletions
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h
index 82562b9aa5..8e51d50426 100644
--- a/src/nvim/ascii.h
+++ b/src/nvim/ascii.h
@@ -91,6 +91,7 @@
#endif
static inline bool ascii_iswhite(int c) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_CONST;
+static inline bool ascii_isdigit(int c) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_CONST;
/// ascii_iswhite() is used for "^" and the like. It differs from isspace()
/// because it doesn't include <CR> and <LF> and the like.
@@ -99,4 +100,13 @@ static inline bool ascii_iswhite(int c)
return c == ' ' || c == '\t';
}
+/// Use our own isdigit() replacement, because on MS-Windows isdigit() returns
+/// non-zero for superscript 1. Also avoids that isdigit() crashes for numbers
+/// below 0 and above 255.
+static inline bool ascii_isdigit(int c)
+{
+ return c >= '0' && c <= '9';
+}
+
+
#endif /* NVIM_ASCII_H */
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 4585278714..e4c7703d77 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -752,7 +752,7 @@ do_bufdel (
arg = skipwhite(arg);
if (*arg == NUL)
break;
- if (!VIM_ISDIGIT(*arg)) {
+ if (!ascii_isdigit(*arg)) {
p = skiptowhite_esc(arg);
bnr = buflist_findpat(arg, p, command == DOBUF_WIPE,
FALSE, FALSE);
@@ -3012,7 +3012,7 @@ build_stl_str_hl (
s++;
l = -1;
}
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
minwid = getdigits_int(&s);
if (minwid < 0) /* overflow */
minwid = 0;
@@ -3048,7 +3048,7 @@ build_stl_str_hl (
}
if (*s == '.') {
s++;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
maxwid = getdigits_int(&s);
if (maxwid <= 0) /* overflow */
maxwid = 50;
@@ -3321,7 +3321,7 @@ build_stl_str_hl (
if (minwid > 0) {
for (; l < minwid && p + 1 < out + outlen; l++) {
/* Don't put a "-" in front of a digit. */
- if (l + 1 == minwid && fillchar == '-' && VIM_ISDIGIT(*t))
+ if (l + 1 == minwid && fillchar == '-' && ascii_isdigit(*t))
*p++ = ' ';
else
*p++ = fillchar;
@@ -3334,7 +3334,7 @@ build_stl_str_hl (
/* Change a space by fillchar, unless fillchar is '-' and a
* digit follows. */
if (fillable && p[-1] == ' '
- && (!VIM_ISDIGIT(*t) || fillchar != '-'))
+ && (!ascii_isdigit(*t) || fillchar != '-'))
p[-1] = fillchar;
}
for (; l < minwid && p + 1 < out + outlen; l++)
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 55dee08090..37e7e6516b 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -177,7 +177,7 @@ int buf_init_chartab(buf_T *buf, int global)
++p;
}
- if (VIM_ISDIGIT(*p)) {
+ if (ascii_isdigit(*p)) {
c = getdigits_int(&p);
} else if (has_mbyte) {
c = mb_ptr2char_adv(&p);
@@ -189,7 +189,7 @@ int buf_init_chartab(buf_T *buf, int global)
if ((*p == '-') && (p[1] != NUL)) {
++p;
- if (VIM_ISDIGIT(*p)) {
+ if (ascii_isdigit(*p)) {
c2 = getdigits_int(&p);
} else if (has_mbyte) {
c2 = mb_ptr2char_adv(&p);
@@ -1422,7 +1422,7 @@ char_u* skipwhite(char_u *q)
char_u* skipdigits(char_u *q)
{
char_u *p = q;
- while (VIM_ISDIGIT(*p)) {
+ while (ascii_isdigit(*p)) {
// skip to next non-digit
p++;
}
@@ -1453,7 +1453,7 @@ char_u* skiphex(char_u *q)
char_u* skiptodigit(char_u *q)
{
char_u *p = q;
- while (*p != NUL && !VIM_ISDIGIT(*p)) {
+ while (*p != NUL && !ascii_isdigit(*p)) {
// skip to next digit
p++;
}
@@ -1475,19 +1475,6 @@ char_u* skiptohex(char_u *q)
return p;
}
-/// Variant of isdigit() that can handle characters > 0x100.
-/// We don't use isdigit() here, because on some systems it also considers
-/// superscript 1 to be a digit.
-/// Use the VIM_ISDIGIT() macro for simple arguments.
-///
-/// @param c
-///
-/// @return TRUE if the character is a digit.
-int vim_isdigit(int c)
-{
- return c >= '0' && c <= '9';
-}
-
/// Variant of isxdigit() that can handle characters > 0x100.
/// We don't use isxdigit() here, because on some systems it also considers
/// superscript 1 to be a digit.
@@ -1773,7 +1760,7 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex,
if (dooct) {
// Don't interpret "0", "08" or "0129" as octal.
- for (n = 1; VIM_ISDIGIT(ptr[n]); ++n) {
+ for (n = 1; ascii_isdigit(ptr[n]); ++n) {
if (ptr[n] > '7') {
// can't be octal
hex = 0;
@@ -1804,7 +1791,7 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex,
}
} else {
// decimal
- while (VIM_ISDIGIT(*ptr)) {
+ while (ascii_isdigit(*ptr)) {
un = 10 * un + (unsigned long)(*ptr - '0');
ptr++;
}
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 2e98b8f512..2fbab13e56 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -133,7 +133,7 @@ char_u *parse_shape_opt(int what)
len = 8;
if (len != 0) {
p += len;
- if (!VIM_ISDIGIT(*p))
+ if (!ascii_isdigit(*p))
return (char_u *)N_("E548: digit expected");
int n = getdigits_int(&p);
if (len == 3) { /* "ver" or "hor" */
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 42965a7139..d4fbb290c1 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1781,7 +1781,7 @@ int diffopt_changed(void)
if (STRNCMP(p, "filler", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_FILLER;
- } else if ((STRNCMP(p, "context:", 8) == 0) && VIM_ISDIGIT(p[8])) {
+ } else if ((STRNCMP(p, "context:", 8) == 0) && ascii_isdigit(p[8])) {
p += 8;
diff_context_new = getdigits_int(&p);
} else if (STRNCMP(p, "icase", 5) == 0) {
@@ -1796,7 +1796,7 @@ int diffopt_changed(void)
} else if (STRNCMP(p, "vertical", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_VERTICAL;
- } else if ((STRNCMP(p, "foldcolumn:", 11) == 0) && VIM_ISDIGIT(p[11])) {
+ } else if ((STRNCMP(p, "foldcolumn:", 11) == 0) && ascii_isdigit(p[11])) {
p += 11;
diff_foldcolumn_new = getdigits_int(&p);
}
@@ -2112,7 +2112,7 @@ void ex_diffgetput(exarg_T *eap)
p--;
}
- for (i = 0; vim_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) {
+ for (i = 0; ascii_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) {
}
if (eap->arg + i == p) {
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index cf998c041d..63329c878c 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1609,7 +1609,7 @@ void putdigraph(char_u *str)
}
str = skipwhite(str);
- if (!VIM_ISDIGIT(*str)) {
+ if (!ascii_isdigit(*str)) {
EMSG(_(e_number_exp));
return;
}
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 9d475849cf..b90ed61b45 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -4730,7 +4730,7 @@ int get_literal(void)
break;
cc = cc * 8 + nc - '0';
} else {
- if (!VIM_ISDIGIT(nc))
+ if (!ascii_isdigit(nc))
break;
cc = cc * 10 + nc - '0';
}
@@ -5545,7 +5545,7 @@ static void redo_literal(int c)
/* Only digits need special treatment. Translate them into a string of
* three digits. */
- if (VIM_ISDIGIT(c)) {
+ if (ascii_isdigit(c)) {
vim_snprintf((char *)buf, sizeof(buf), "%03d", c);
AppendToRedobuff(buf);
} else
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 37a3514206..29c412ed68 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1299,7 +1299,7 @@ int eval_foldexpr(char_u *arg, int *cp)
/* If the result is a string, check if there is a non-digit before
* the number. */
s = tv.vval.v_string;
- if (!VIM_ISDIGIT(*s) && *s != '-')
+ if (!ascii_isdigit(*s) && *s != '-')
*cp = *s++;
retval = atol((char *)s);
}
@@ -2754,7 +2754,7 @@ void ex_lockvar(exarg_T *eap)
if (eap->forceit)
deep = -1;
- else if (vim_isdigit(*arg)) {
+ else if (ascii_isdigit(*arg)) {
deep = getdigits_int(&arg);
arg = skipwhite(arg);
}
@@ -4005,14 +4005,14 @@ eval7 (
* strict to avoid backwards compatibility problems.
* Don't look for a float after the "." operator, so that
* ":let vers = 1.2.3" doesn't fail. */
- if (!want_string && p[0] == '.' && vim_isdigit(p[1])) {
+ if (!want_string && p[0] == '.' && ascii_isdigit(p[1])) {
get_float = TRUE;
p = skipdigits(p + 2);
if (*p == 'e' || *p == 'E') {
++p;
if (*p == '-' || *p == '+')
++p;
- if (!vim_isdigit(*p))
+ if (!ascii_isdigit(*p))
get_float = FALSE;
else
p = skipdigits(p + 1);
@@ -8940,7 +8940,7 @@ static void f_function(typval_T *argvars, typval_T *rettv)
char_u *s;
s = get_tv_string(&argvars[0]);
- if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
+ if (s == NULL || *s == NUL || ascii_isdigit(*s))
EMSG2(_(e_invarg2), s);
/* Don't check an autoload name for existence here. */
else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
@@ -10020,9 +10020,9 @@ static void f_has(typval_T *argvars, typval_T *rettv)
if (STRNICMP(name, "patch", 5) == 0) {
if (name[5] == '-'
&& STRLEN(name) > 11
- && vim_isdigit(name[6])
- && vim_isdigit(name[8])
- && vim_isdigit(name[10])) {
+ && ascii_isdigit(name[6])
+ && ascii_isdigit(name[8])
+ && ascii_isdigit(name[10])) {
int major = atoi((char *)name + 6);
int minor = atoi((char *)name + 8);
@@ -13663,7 +13663,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv)
break;
case 'b': case Ctrl_V: /* block-wise selection */
yank_type = MBLOCK;
- if (VIM_ISDIGIT(stropt[1])) {
+ if (ascii_isdigit(stropt[1])) {
++stropt;
block_len = getdigits_long(&stropt) - 1;
--stropt;
@@ -17247,7 +17247,7 @@ static int valid_varname(char_u *varname)
char_u *p;
for (p = varname; *p != NUL; ++p)
- if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p))
+ if (!eval_isnamec1(*p) && (p == varname || !ascii_isdigit(*p))
&& *p != AUTOLOAD_CHAR) {
EMSG2(_(e_illvar), varname);
return FALSE;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 1dc1d9c420..78200e4689 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1858,7 +1858,7 @@ viminfo_readstring (
char_u *retval;
char_u *s, *d;
- if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1])) {
+ if (virp->vir_line[off] == Ctrl_V && ascii_isdigit(virp->vir_line[off + 1])) {
ssize_t len = atol((char *)virp->vir_line + off + 1);
retval = xmalloc(len);
// TODO(philix): change type of vim_fgets() size argument to size_t
@@ -3244,7 +3244,7 @@ void ex_z(exarg_T *eap)
++x;
if (*x != 0) {
- if (!VIM_ISDIGIT(*x)) {
+ if (!ascii_isdigit(*x)) {
EMSG(_("E144: non-numeric argument to :z"));
return;
}
@@ -3591,7 +3591,7 @@ void do_sub(exarg_T *eap)
* check for a trailing count
*/
cmd = skipwhite(cmd);
- if (VIM_ISDIGIT(*cmd)) {
+ if (ascii_isdigit(*cmd)) {
i = getdigits_long(&cmd);
if (i <= 0 && !eap->skip && do_error) {
EMSG(_(e_zerocount));
@@ -5867,7 +5867,7 @@ void ex_sign(exarg_T *eap)
/* first arg could be placed sign id */
arg1 = arg;
- if (VIM_ISDIGIT(*arg))
+ if (ascii_isdigit(*arg))
{
id = getdigits_int(&arg);
if (!ascii_iswhite(*arg) && *arg != NUL)
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index fdcd467cb8..52f27cc059 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -465,7 +465,7 @@ dbg_parsearg (
bp->dbg_lnum = curwin->w_cursor.lnum;
else if (
gap != &prof_ga &&
- VIM_ISDIGIT(*p)) {
+ ascii_isdigit(*p)) {
bp->dbg_lnum = getdigits_long(&p);
p = skipwhite(p);
} else
@@ -570,7 +570,7 @@ void ex_breakdel(exarg_T *eap)
gap = &prof_ga;
}
- if (vim_isdigit(*eap->arg)) {
+ if (ascii_isdigit(*eap->arg)) {
/* ":breakdel {nr}" */
nr = atol((char *)eap->arg);
for (int i = 0; i < gap->ga_len; ++i)
@@ -3023,7 +3023,7 @@ static char_u *get_mess_env(void)
p = (char_u *)os_getenv("LC_MESSAGES");
if (p == NULL || *p == NUL) {
p = (char_u *)os_getenv("LANG");
- if (p != NULL && VIM_ISDIGIT(*p))
+ if (p != NULL && ascii_isdigit(*p))
p = NULL; /* ignore something like "1043" */
# ifdef HAVE_GET_LOCALE_VAL
if (p == NULL || *p == NUL)
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 56def23258..b4bd6e1bd5 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1157,7 +1157,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
* 2. handle command modifiers.
*/
p = ea.cmd;
- if (VIM_ISDIGIT(*ea.cmd))
+ if (ascii_isdigit(*ea.cmd))
p = skipwhite(skipdigits(ea.cmd));
switch (*p) {
/* When adding an entry, also modify cmd_exists(). */
@@ -1260,7 +1260,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
continue;
case 't': if (checkforcmd(&p, "tab", 3)) {
- if (vim_isdigit(*ea.cmd))
+ if (ascii_isdigit(*ea.cmd))
cmdmod.tab = atoi((char *)ea.cmd) + 1;
else
cmdmod.tab = tabpage_index(curtab) + 1;
@@ -1287,7 +1287,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
break;
if (verbose_save < 0)
verbose_save = p_verbose;
- if (vim_isdigit(*ea.cmd))
+ if (ascii_isdigit(*ea.cmd))
p_verbose = atoi((char *)ea.cmd);
else
p_verbose = 1;
@@ -1703,7 +1703,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
&& *ea.arg != NUL
/* Do not allow register = for user commands */
&& (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
- && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) {
+ && !((ea.argt & COUNT) && ascii_isdigit(*ea.arg))) {
if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
&& !IS_USER_CMDIDX(ea.cmdidx)))) {
ea.regname = *ea.arg++;
@@ -1720,7 +1720,7 @@ 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.
*/
- if ((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)
+ if ((ea.argt & COUNT) && ascii_isdigit(*ea.arg)
&& (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|| ascii_iswhite(*p))) {
n = getdigits_long(&ea.arg);
@@ -2168,7 +2168,7 @@ find_ucmd (
k = 0;
while (k < len && *np != NUL && *cp++ == *np++)
k++;
- if (k == len || (*np == NUL && vim_isdigit(eap->cmd[k]))) {
+ if (k == len || (*np == NUL && ascii_isdigit(eap->cmd[k]))) {
/* If finding a second match, the command is ambiguous. But
* not if a buffer-local command wasn't a full match and a
* global command is a full match. */
@@ -2272,7 +2272,7 @@ int modifier_len(char_u *cmd)
int i, j;
char_u *p = cmd;
- if (VIM_ISDIGIT(*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)
@@ -2314,7 +2314,7 @@ int cmd_exists(char_u *name)
p = find_command(&ea, &full);
if (p == NULL)
return 3;
- if (vim_isdigit(*name) && ea.cmdidx != CMD_match)
+ if (ascii_isdigit(*name) && ea.cmdidx != CMD_match)
return 0;
if (*skipwhite(p) != NUL)
return 0; /* trailing garbage */
@@ -3223,22 +3223,22 @@ get_address (
break;
default:
- if (VIM_ISDIGIT(*cmd)) /* absolute line number */
+ if (ascii_isdigit(*cmd)) /* absolute line number */
lnum = getdigits_long(&cmd);
}
for (;; ) {
cmd = skipwhite(cmd);
- if (*cmd != '-' && *cmd != '+' && !VIM_ISDIGIT(*cmd))
+ if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd))
break;
if (lnum == MAXLNUM)
lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */
- if (VIM_ISDIGIT(*cmd))
+ if (ascii_isdigit(*cmd))
i = '+'; /* "number" is same as "+number" */
else
i = *cmd++;
- if (!VIM_ISDIGIT(*cmd)) /* '+' is '+1', but '+0' is not '+1' */
+ if (!ascii_isdigit(*cmd)) /* '+' is '+1', but '+0' is not '+1' */
n = 1;
else
n = getdigits_long(&cmd);
@@ -6878,7 +6878,7 @@ static void ex_mkrc(exarg_T *eap)
/* ":mkview" or ":mkview 9": generate file name with 'viewdir' */
if (eap->cmdidx == CMD_mkview
&& (*eap->arg == NUL
- || (vim_isdigit(*eap->arg) && eap->arg[1] == NUL))) {
+ || (ascii_isdigit(*eap->arg) && eap->arg[1] == NUL))) {
eap->forceit = TRUE;
fname = get_view_file(*eap->arg);
if (fname == NULL)
@@ -7295,7 +7295,7 @@ static void ex_findpat(exarg_T *eap)
}
n = 1;
- if (vim_isdigit(*eap->arg)) { /* get count */
+ if (ascii_isdigit(*eap->arg)) { /* get count */
n = getdigits_long(&eap->arg);
eap->arg = skipwhite(eap->arg);
}
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 5ed7a35209..224d9e9bf7 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -257,9 +257,9 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
/* Skip the extra "Vim " prefix for message "E458". */
tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0
- && VIM_ISDIGIT(tmsg[5])
- && VIM_ISDIGIT(tmsg[6])
- && VIM_ISDIGIT(tmsg[7])
+ && ascii_isdigit(tmsg[5])
+ && ascii_isdigit(tmsg[6])
+ && ascii_isdigit(tmsg[7])
&& tmsg[8] == ':'
&& tmsg[9] == ' ')
(*msg_list)->throw_msg = &tmsg[4];
@@ -405,11 +405,11 @@ char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should
for (p = mesg;; p++) {
if (*p == NUL
|| (*p == 'E'
- && VIM_ISDIGIT(p[1])
+ && ascii_isdigit(p[1])
&& (p[2] == ':'
- || (VIM_ISDIGIT(p[2])
+ || (ascii_isdigit(p[2])
&& (p[3] == ':'
- || (VIM_ISDIGIT(p[3])
+ || (ascii_isdigit(p[3])
&& p[4] == ':')))))) {
if (*p == NUL || p == mesg)
STRCAT(val, mesg); /* 'E123' missing or at beginning */
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 6c6c72fc36..3342c92c57 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4641,7 +4641,7 @@ int get_list_range(char_u **str, int *num1, int *num2)
long num;
*str = skipwhite(*str);
- if (**str == '-' || vim_isdigit(**str)) { /* parse "from" part of range */
+ if (**str == '-' || ascii_isdigit(**str)) { /* parse "from" part of range */
vim_str2nr(*str, NULL, &len, FALSE, FALSE, &num, NULL);
*str += len;
*num1 = (int)num;
@@ -4681,7 +4681,7 @@ void ex_history(exarg_T *eap)
return;
}
- if (!(VIM_ISDIGIT(*arg) || *arg == '-' || *arg == ',')) {
+ if (!(ascii_isdigit(*arg) || *arg == '-' || *arg == ',')) {
end = arg;
while (ASCII_ISALPHA(*end)
|| vim_strchr((char_u *)":=@>/?", *end) != NULL)
diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c
index f9d6b14edc..80ef7cbc13 100644
--- a/src/nvim/farsi.c
+++ b/src/nvim/farsi.c
@@ -599,7 +599,7 @@ int fkmap(int c)
return c;
}
- if (VIM_ISDIGIT(c)
+ if (ascii_isdigit(c)
|| ((c == '.'
|| c == '+'
|| c == '-'
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index bb9db7e6cd..bb4b7a140b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -2006,7 +2006,7 @@ failed:
static int is_dev_fd_file(char_u *fname)
{
return STRNCMP(fname, "/dev/fd/", 8) == 0
- && VIM_ISDIGIT(fname[8])
+ && ascii_isdigit(fname[8])
&& *skipdigits(fname + 9) == NUL
&& (fname[9] != NUL
|| (fname[8] != '0' && fname[8] != '1' && fname[8] != '2'));
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 56f1aade44..654cdf82a8 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1651,7 +1651,7 @@ static void foldDelMarker(linenr_T lnum, char_u *marker, size_t markerlen)
}
/* Found the marker, include a digit if it's there. */
size_t len = markerlen;
- if (VIM_ISDIGIT(p[len]))
+ if (ascii_isdigit(p[len]))
++len;
if (*cms != NUL) {
/* Also delete 'commentstring' if it matches. */
@@ -1815,7 +1815,7 @@ void foldtext_cleanup(char_u *str)
else if (STRNCMP(s, foldendmarker, foldendmarkerlen) == 0)
len = foldendmarkerlen;
if (len > 0) {
- if (VIM_ISDIGIT(s[len]))
+ if (ascii_isdigit(s[len]))
++len;
/* May remove 'commentstring' start. Useful when it's a double
@@ -2799,7 +2799,7 @@ static void foldlevelMarker(fline_T *flp)
&& STRNCMP(s + 1, startmarker, foldstartmarkerlen - 1) == 0) {
/* found startmarker: set flp->lvl */
s += foldstartmarkerlen;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
n = atoi((char *)s);
if (n > 0) {
flp->lvl = n;
@@ -2818,7 +2818,7 @@ static void foldlevelMarker(fline_T *flp)
foldendmarkerlen - 1) == 0) {
/* found endmarker: set flp->lvl_next */
s += foldendmarkerlen;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
n = atoi((char *)s);
if (n > 0) {
flp->lvl = n;
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index fbf3c31e1e..dd4785b41f 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -771,7 +771,7 @@ int start_redo(long count, int old_redo)
/* try to enter the count (in place of a previous count) */
if (count) {
- while (VIM_ISDIGIT(c)) /* skip "old" count */
+ while (ascii_isdigit(c)) /* skip "old" count */
c = read_redo(FALSE, old_redo);
add_num_buff(&readbuf2, count);
}
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 0cbbe95572..cf33703fdb 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -317,7 +317,7 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, int
table[idx].present = TRUE;
if (table[idx].hasnum) {
- if (!VIM_ISDIGIT(*p))
+ if (!ascii_isdigit(*p))
return (char_u *)N_("E552: digit expected");
table[idx].number = getdigits_int(&p);
@@ -2272,7 +2272,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
*/
fontsize = PRT_PS_DEFAULT_FONTSIZE;
for (p = p_pfn; (p = vim_strchr(p, ':')) != NULL; ++p)
- if (p[1] == 'h' && VIM_ISDIGIT(p[2]))
+ if (p[1] == 'h' && ascii_isdigit(p[2]))
fontsize = atoi((char *)p + 2);
prt_font_metrics(fontsize);
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index e25ab89027..bdaf88e574 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1273,9 +1273,9 @@ static int cs_kill(exarg_T *eap)
}
/* only single digit positive and negative integers are allowed */
- if ((strlen(stok) < 2 && VIM_ISDIGIT((int)(stok[0])))
+ if ((strlen(stok) < 2 && ascii_isdigit((int)(stok[0])))
|| (strlen(stok) < 3 && stok[0] == '-'
- && VIM_ISDIGIT((int)(stok[1]))))
+ && ascii_isdigit((int)(stok[1]))))
i = atoi(stok);
else {
/* It must be part of a name. We will try to find a match
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 00a5e76c9c..d62e7aad03 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -82,7 +82,7 @@ static char_u *skip_string(char_u *p)
i = 2;
if (p[1] == '\\') { /* '\n' or '\000' */
++i;
- while (vim_isdigit(p[i - 1])) /* '\000' */
+ while (ascii_isdigit(p[i - 1])) /* '\000' */
++i;
}
if (p[i] == '\'') { /* check for trailing ' */
@@ -1467,7 +1467,7 @@ void parse_cino(buf_T *buf)
divider = 0;
if (*p == '.') { /* ".5s" means a fraction */
fraction = atoi((char *)++p);
- while (VIM_ISDIGIT(*p)) {
+ while (ascii_isdigit(*p)) {
++p;
if (divider)
divider *= 10;
@@ -1673,7 +1673,7 @@ int get_c_indent(void)
what = *p++;
else if (*p == COM_LEFT || *p == COM_RIGHT)
align = *p++;
- else if (VIM_ISDIGIT(*p) || *p == '-') {
+ else if (ascii_isdigit(*p) || *p == '-') {
off = getdigits_int(&p);
}
else
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 2026e08de5..455615d318 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -601,7 +601,7 @@ find_special_key (
*/
if (bp >= last_dash) {
if (STRNICMP(last_dash + 1, "char-", 5) == 0
- && VIM_ISDIGIT(last_dash[6])) {
+ && ascii_isdigit(last_dash[6])) {
/* <Char-123> or <Char-033> or <Char-0x33> */
vim_str2nr(last_dash + 6, NULL, NULL, TRUE, TRUE, NULL, &n);
key = (int)n;
@@ -788,7 +788,7 @@ char_u * replace_termcodes (
src = from;
// Check for #n at start only: function key n
- if (from_part && src[0] == '#' && VIM_ISDIGIT(src[1])) { // function key
+ if (from_part && src[0] == '#' && ascii_isdigit(src[1])) { // function key
result[dlen++] = K_SPECIAL;
result[dlen++] = 'k';
if (src[1] == '0') {
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index e14e998e7a..46f591eb33 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -56,17 +56,12 @@
# define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A'))
# define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A'))
-/* Use our own isdigit() replacement, because on MS-Windows isdigit() returns
- * non-zero for superscript 1. Also avoids that isdigit() crashes for numbers
- * below 0 and above 255. */
-#define VIM_ISDIGIT(c) ((unsigned)(c) >= '0' && (unsigned)(c) <= '9')
-
/* Like isalpha() but reject non-ASCII characters. Can't be used with a
* special key (negative value). */
# define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z')
# define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z')
# define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
-# define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || VIM_ISDIGIT(c))
+# define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || ascii_isdigit(c))
/* macro version of chartab().
* Only works with values 0-255!
diff --git a/src/nvim/main.c b/src/nvim/main.c
index af6e49ce48..e1d53183aa 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -806,9 +806,9 @@ void getout(int exitval)
/// @return argument's numeric value otherwise
static int get_number_arg(const char *p, int *idx, int def)
{
- if (vim_isdigit(p[*idx])) {
+ if (ascii_isdigit(p[*idx])) {
def = atoi(&(p[*idx]));
- while (vim_isdigit(p[*idx])) {
+ while (ascii_isdigit(p[*idx])) {
*idx = *idx + 1;
}
}
@@ -1096,7 +1096,7 @@ static void command_line_scan(mparm_T *parmp)
case 'w': /* "-w{number}" set window height */
/* "-w {scriptout}" write to script */
- if (vim_isdigit(((char_u *)argv[0])[argv_idx])) {
+ if (ascii_isdigit(((char_u *)argv[0])[argv_idx])) {
n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value((char_u *)"window", n, NULL, 0);
break;
@@ -1240,7 +1240,7 @@ scripterror:
case 'w': /* "-w {nr}" 'window' value */
/* "-w {scriptout}" append to script file */
- if (vim_isdigit(*((char_u *)argv[0]))) {
+ if (ascii_isdigit(*((char_u *)argv[0]))) {
argv_idx = 0;
n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value((char_u *)"window", n, NULL, 0);
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index a142d12c13..10725ae4e5 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -358,8 +358,8 @@ pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum)
}
} else if (ASCII_ISLOWER(c)) { /* normal named mark */
posp = &(buf->b_namedm[c - 'a']);
- } else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) { /* named file mark */
- if (VIM_ISDIGIT(c))
+ } else if (ASCII_ISUPPER(c) || ascii_isdigit(c)) { /* named file mark */
+ if (ascii_isdigit(c))
c = c - '0' + NMARKS;
else
c -= 'A';
@@ -708,14 +708,14 @@ void ex_delmarks(exarg_T *eap)
/* clear specified marks only */
for (p = eap->arg; *p != NUL; ++p) {
lower = ASCII_ISLOWER(*p);
- digit = VIM_ISDIGIT(*p);
+ digit = ascii_isdigit(*p);
if (lower || digit || ASCII_ISUPPER(*p)) {
if (p[1] == '-') {
/* clear range of marks */
from = *p;
to = p[2];
if (!(lower ? ASCII_ISLOWER(p[2])
- : (digit ? VIM_ISDIGIT(p[2])
+ : (digit ? ascii_isdigit(p[2])
: ASCII_ISUPPER(p[2])))
|| to < from) {
EMSG2(_(e_invarg2), p);
@@ -1183,7 +1183,7 @@ int read_viminfo_filemark(vir_T *virp, int force)
str = virp->vir_line + 1;
if (
*str <= 127 &&
- ((*virp->vir_line == '\'' && (VIM_ISDIGIT(*str) || isupper(*str)))
+ ((*virp->vir_line == '\'' && (ascii_isdigit(*str) || isupper(*str)))
|| (*virp->vir_line == '-' && *str == '\''))) {
if (*str == '\'') {
/* If the jumplist isn't full insert fmark as oldest entry */
@@ -1198,7 +1198,7 @@ int read_viminfo_filemark(vir_T *virp, int force)
fm->fmark.mark.lnum = 0;
fm->fname = NULL;
}
- } else if (VIM_ISDIGIT(*str))
+ } else if (ascii_isdigit(*str))
fm = &namedfm[*str - '0' + NMARKS];
else { // is uppercase
assert(*str >= 'A' && *str <= 'Z');
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index d5dc039c3f..a5841c5d63 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -115,7 +115,7 @@ ex_menu (
* Fill in the priority table.
*/
for (p = arg; *p; ++p)
- if (!VIM_ISDIGIT(*p) && *p != '.')
+ if (!ascii_isdigit(*p) && *p != '.')
break;
if (ascii_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); ++i) {
@@ -835,7 +835,7 @@ char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forc
/* Check for priority numbers, enable and disable */
for (p = arg; *p; ++p)
- if (!VIM_ISDIGIT(*p) && *p != '.')
+ if (!ascii_isdigit(*p) && *p != '.')
break;
if (!ascii_iswhite(*p)) {
diff --git a/src/nvim/message.c b/src/nvim/message.c
index bd47e71c31..744f721410 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -3204,12 +3204,12 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs)
min_field_width = -j;
justify_left = 1;
}
- } else if (VIM_ISDIGIT((int)(*p))) {
+ } else if (ascii_isdigit((int)(*p))) {
/* size_t could be wider than unsigned int; make sure we treat
* argument like common implementations do */
unsigned int uj = *p++ - '0';
- while (VIM_ISDIGIT((int)(*p)))
+ while (ascii_isdigit((int)(*p)))
uj = 10 * uj + (unsigned int)(*p++ - '0');
min_field_width = uj;
}
@@ -3229,12 +3229,12 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs)
precision_specified = 0;
precision = 0;
}
- } else if (VIM_ISDIGIT((int)(*p))) {
+ } else if (ascii_isdigit((int)(*p))) {
/* size_t could be wider than unsigned int; make sure we
* treat argument like common implementations do */
unsigned int uj = *p++ - '0';
- while (VIM_ISDIGIT((int)(*p)))
+ while (ascii_isdigit((int)(*p)))
uj = 10 * uj + (unsigned int)(*p++ - '0');
precision = uj;
}
@@ -3643,8 +3643,8 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs)
fmt_spec == 'e' ? 'e' : 'E');
if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
&& tp[2] == '0'
- && vim_isdigit(tp[3])
- && vim_isdigit(tp[4])) {
+ && ascii_isdigit(tp[3])
+ && ascii_isdigit(tp[4])) {
STRMOVE(tp + 2, tp + 3);
--str_arg_l;
}
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 7460f94fbe..db65ad724f 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -524,7 +524,7 @@ open_line (
for (p = lead_flags; *p != NUL && *p != ':'; ) {
if (*p == COM_RIGHT || *p == COM_LEFT)
c = *p++;
- else if (VIM_ISDIGIT(*p) || *p == '-')
+ else if (ascii_isdigit(*p) || *p == '-')
off = getdigits_int(&p);
else
++p;
@@ -2465,7 +2465,7 @@ get_number (
for (;; ) {
ui_cursor_goto(msg_row, msg_col);
c = safe_vgetc();
- if (VIM_ISDIGIT(c)) {
+ if (ascii_isdigit(c)) {
n = n * 10 + c - '0';
msg_putchar(c);
++typed;
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e3649db5d5..b122b3e1d5 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -3593,7 +3593,7 @@ static void nv_zet(cmdarg_T *cap)
int old_fen = curwin->w_p_fen;
bool undo = false;
- if (VIM_ISDIGIT(nchar)) {
+ if (ascii_isdigit(nchar)) {
/*
* "z123{nchar}": edit the count before obtaining {nchar}
*/
@@ -3610,7 +3610,7 @@ static void nv_zet(cmdarg_T *cap)
(void)add_to_showcmd(nchar);
if (nchar == K_DEL || nchar == K_KDEL)
n /= 10;
- else if (VIM_ISDIGIT(nchar))
+ else if (ascii_isdigit(nchar))
n = n * 10 + (nchar - '0');
else if (nchar == CAR) {
win_setheight((int)n);
@@ -7252,7 +7252,7 @@ static void nv_put(cmdarg_T *cap)
was_visual = true;
regname = cap->oap->regname;
if (regname == 0 || regname == '"'
- || VIM_ISDIGIT(regname) || regname == '-') {
+ || ascii_isdigit(regname) || regname == '-') {
// The delete might overwrite the register we want to put, save it first
savereg = copy_register(regname);
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index c89ffa212f..17183bd350 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -772,7 +772,7 @@ yankreg_T *get_yank_register(int regname, int mode)
}
int i = 0; // when not 0-9, a-z, A-Z or '-'/'+'/'*': use register 0
- if (VIM_ISDIGIT(regname))
+ if (ascii_isdigit(regname))
i = regname - '0';
else if (ASCII_ISLOWER(regname))
i = CharOrdLow(regname) + 10;
@@ -4260,12 +4260,12 @@ int do_addsub(int command, linenr_T Prenum1)
col = curwin->w_cursor.col;
while (ptr[col] != NUL
- && !vim_isdigit(ptr[col])
+ && !ascii_isdigit(ptr[col])
&& !(doalp && ASCII_ISALPHA(ptr[col])))
++col;
while (col > 0
- && vim_isdigit(ptr[col - 1])
+ && ascii_isdigit(ptr[col - 1])
&& !(doalp && ASCII_ISALPHA(ptr[col])))
--col;
}
@@ -4275,7 +4275,7 @@ int do_addsub(int command, linenr_T Prenum1)
*/
firstdigit = ptr[col];
RLADDSUBFIX(ptr);
- if ((!VIM_ISDIGIT(firstdigit) && !(doalp && ASCII_ISALPHA(firstdigit)))
+ if ((!ascii_isdigit(firstdigit) && !(doalp && ASCII_ISALPHA(firstdigit)))
|| u_save_cursor() != OK) {
beep_flush();
return FAIL;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index e91248924d..12118cdebc 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2671,7 +2671,7 @@ do_set (
&& (*arg == '<'
|| *arg == '^'
|| ((!arg[1] || ascii_iswhite(arg[1]))
- && !VIM_ISDIGIT(*arg)))) {
+ && !ascii_isdigit(*arg)))) {
value = string_to_key(arg);
if (value == 0 && (long *)varp != &p_wcm) {
errmsg = e_invarg;
@@ -2679,14 +2679,14 @@ do_set (
}
}
/* allow negative numbers (for 'undolevels') */
- else if (*arg == '-' || VIM_ISDIGIT(*arg)) {
+ else if (*arg == '-' || ascii_isdigit(*arg)) {
i = 0;
if (*arg == '-')
i = 1;
value = strtol((char *)arg, NULL, 0);
if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
i += 2;
- while (VIM_ISDIGIT(arg[i]))
+ while (ascii_isdigit(arg[i]))
++i;
if (arg[i] != NUL && !ascii_iswhite(arg[i])) {
errmsg = e_invarg;
@@ -2767,7 +2767,7 @@ do_set (
* adding, prepending and removing string.
*/
else if (varp == (char_u *)&p_bs
- && VIM_ISDIGIT(**(char_u **)varp)) {
+ && ascii_isdigit(**(char_u **)varp)) {
i = getdigits_int((char_u **)varp);
switch (i) {
case 0:
@@ -2791,7 +2791,7 @@ do_set (
* Misuse errbuf[] for the resulting string.
*/
else if (varp == (char_u *)&p_ww
- && VIM_ISDIGIT(*arg)) {
+ && ascii_isdigit(*arg)) {
*errbuf = NUL;
i = getdigits_int(&arg);
if (i & 1)
@@ -3212,7 +3212,7 @@ int get_viminfo_parameter(int type)
char_u *p;
p = find_viminfo_parameter(type);
- if (p != NULL && VIM_ISDIGIT(*p))
+ if (p != NULL && ascii_isdigit(*p))
return atoi((char *)p);
return -1;
}
@@ -3883,7 +3883,7 @@ did_set_string_option (
for (s = *varp; *s; ) {
while (*s && *s != ':') {
if (vim_strchr((char_u *)COM_ALL, *s) == NULL
- && !VIM_ISDIGIT(*s) && *s != '-') {
+ && !ascii_isdigit(*s) && *s != '-') {
errmsg = illegal_char(errbuf, *s);
break;
}
@@ -3936,15 +3936,15 @@ did_set_string_option (
;
} else if (*s == '%') {
/* optional number */
- while (vim_isdigit(*++s))
+ while (ascii_isdigit(*++s))
;
} else if (*s == '!' || *s == 'h' || *s == 'c')
++s; /* no extra chars */
else { /* must have a number */
- while (vim_isdigit(*++s))
+ while (ascii_isdigit(*++s))
;
- if (!VIM_ISDIGIT(*(s - 1))) {
+ if (!ascii_isdigit(*(s - 1))) {
if (errbuf != NULL) {
sprintf((char *)errbuf,
_("E526: Missing number after <%s>"),
@@ -4188,7 +4188,7 @@ did_set_string_option (
}
/* 'backspace' */
else if (varp == &p_bs) {
- if (VIM_ISDIGIT(*p_bs)) {
+ if (ascii_isdigit(*p_bs)) {
if (*p_bs >'2' || p_bs[1] != NUL)
errmsg = e_invarg;
} else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
@@ -4428,7 +4428,7 @@ char_u *check_colorcolumn(win_T *wp)
/* -N and +N: add to 'textwidth' */
col = (*s == '-') ? -1 : 1;
++s;
- if (!VIM_ISDIGIT(*s))
+ if (!ascii_isdigit(*s))
return e_invarg;
col = col * getdigits_int(&s);
if (wp->w_buffer->b_p_tw == 0)
@@ -4442,7 +4442,7 @@ char_u *check_colorcolumn(win_T *wp)
col += (int)wp->w_buffer->b_p_tw;
if (col < 0)
goto skip;
- } else if (VIM_ISDIGIT(*s))
+ } else if (ascii_isdigit(*s))
col = getdigits_int(&s);
else
return e_invarg;
@@ -4603,13 +4603,13 @@ char_u *check_stl_option(char_u *s)
}
if (*s == '-')
s++;
- while (VIM_ISDIGIT(*s))
+ while (ascii_isdigit(*s))
s++;
if (*s == STL_USER_HL)
continue;
if (*s == '.') {
s++;
- while (*s && VIM_ISDIGIT(*s))
+ while (*s && ascii_isdigit(*s))
s++;
}
if (*s == '(') {
@@ -7755,12 +7755,12 @@ static bool briopt_check(win_T *wp)
while (*p != NUL)
{
if (STRNCMP(p, "shift:", 6) == 0
- && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
+ && ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6])))
{
p += 6;
bri_shift = getdigits_int(&p);
}
- else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
+ else if (STRNCMP(p, "min:", 4) == 0 && ascii_isdigit(p[4]))
{
p += 4;
bri_min = getdigits_int(&p);
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index b198f0d0f5..b07da08e23 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -2120,7 +2120,7 @@ static char_u *regatom(int *flagp)
}
default:
- if (VIM_ISDIGIT(c) || c == '<' || c == '>'
+ if (ascii_isdigit(c) || c == '<' || c == '>'
|| c == '\'') {
uint32_t n = 0;
int cmp;
@@ -2128,7 +2128,7 @@ static char_u *regatom(int *flagp)
cmp = c;
if (cmp == '<' || cmp == '>')
c = getchr();
- while (VIM_ISDIGIT(c)) {
+ while (ascii_isdigit(c)) {
n = n * 10 + (uint32_t)(c - '0');
c = getchr();
}
@@ -2324,7 +2324,7 @@ collection:
break;
case CLASS_DIGIT:
for (cu = 1; cu <= 255; cu++)
- if (VIM_ISDIGIT(cu))
+ if (ascii_isdigit(cu))
regc(cu);
break;
case CLASS_GRAPH:
@@ -3087,11 +3087,11 @@ static int read_limits(long *minval, long *maxval)
first_char = regparse;
*minval = getdigits_long(&regparse);
if (*regparse == ',') { /* There is a comma */
- if (vim_isdigit(*++regparse))
+ if (ascii_isdigit(*++regparse))
*maxval = getdigits_long(&regparse);
else
*maxval = MAX_LIMIT;
- } else if (VIM_ISDIGIT(*first_char))
+ } else if (ascii_isdigit(*first_char))
*maxval = *minval; /* It was \{n} or \{-n} */
else
*maxval = MAX_LIMIT; /* It was \{} or \{-} */
@@ -3944,7 +3944,7 @@ regmatch (
break;
case SIDENT:
- if (VIM_ISDIGIT(*reginput) || !vim_isIDc(c))
+ if (ascii_isdigit(*reginput) || !vim_isIDc(c))
status = RA_NOMATCH;
else
ADVANCE_REGINPUT();
@@ -3958,7 +3958,7 @@ regmatch (
break;
case SKWORD:
- if (VIM_ISDIGIT(*reginput) || !vim_iswordp_buf(reginput, reg_buf))
+ if (ascii_isdigit(*reginput) || !vim_iswordp_buf(reginput, reg_buf))
status = RA_NOMATCH;
else
ADVANCE_REGINPUT();
@@ -3972,7 +3972,7 @@ regmatch (
break;
case SFNAME:
- if (VIM_ISDIGIT(*reginput) || !vim_isfilec(c))
+ if (ascii_isdigit(*reginput) || !vim_isfilec(c))
status = RA_NOMATCH;
else
ADVANCE_REGINPUT();
@@ -3986,7 +3986,7 @@ regmatch (
break;
case SPRINT:
- if (VIM_ISDIGIT(*reginput) || !vim_isprintc(PTR2CHAR(reginput)))
+ if (ascii_isdigit(*reginput) || !vim_isprintc(PTR2CHAR(reginput)))
status = RA_NOMATCH;
else
ADVANCE_REGINPUT();
@@ -5112,7 +5112,7 @@ regrepeat (
case SIDENT:
case SIDENT + ADD_NL:
while (count < maxcount) {
- if (vim_isIDc(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan))) {
+ if (vim_isIDc(PTR2CHAR(scan)) && (testval || !ascii_isdigit(*scan))) {
mb_ptr_adv(scan);
} else if (*scan == NUL) {
if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
@@ -5138,7 +5138,7 @@ regrepeat (
case SKWORD + ADD_NL:
while (count < maxcount) {
if (vim_iswordp_buf(scan, reg_buf)
- && (testval || !VIM_ISDIGIT(*scan))) {
+ && (testval || !ascii_isdigit(*scan))) {
mb_ptr_adv(scan);
} else if (*scan == NUL) {
if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
@@ -5163,7 +5163,7 @@ regrepeat (
case SFNAME:
case SFNAME + ADD_NL:
while (count < maxcount) {
- if (vim_isfilec(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan))) {
+ if (vim_isfilec(PTR2CHAR(scan)) && (testval || !ascii_isdigit(*scan))) {
mb_ptr_adv(scan);
} else if (*scan == NUL) {
if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
@@ -5197,7 +5197,7 @@ regrepeat (
if (got_int)
break;
} else if (vim_isprintc(PTR2CHAR(scan)) == 1
- && (testval || !VIM_ISDIGIT(*scan))) {
+ && (testval || !ascii_isdigit(*scan))) {
mb_ptr_adv(scan);
} else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p)))
++scan;
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 37b6786b8f..05a3c51182 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1401,7 +1401,7 @@ static int nfa_regatom(void)
if (c == '<' || c == '>')
c = getchr();
- while (VIM_ISDIGIT(c)) {
+ while (ascii_isdigit(c)) {
n = n * 10 + (c - '0');
c = getchr();
}
@@ -4235,7 +4235,7 @@ static int check_char_class(int class, int c)
return OK;
break;
case NFA_CLASS_DIGIT:
- if (VIM_ISDIGIT(c))
+ if (ascii_isdigit(c))
return OK;
break;
case NFA_CLASS_GRAPH:
@@ -5488,7 +5488,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
break;
case NFA_SIDENT: /* \I */
- result = !VIM_ISDIGIT(curc) && vim_isIDc(curc);
+ result = !ascii_isdigit(curc) && vim_isIDc(curc);
ADD_STATE_IF_MATCH(t->state);
break;
@@ -5498,7 +5498,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
break;
case NFA_SKWORD: /* \K */
- result = !VIM_ISDIGIT(curc)
+ result = !ascii_isdigit(curc)
&& vim_iswordp_buf(reginput, reg_buf);
ADD_STATE_IF_MATCH(t->state);
break;
@@ -5509,7 +5509,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
break;
case NFA_SFNAME: /* \F */
- result = !VIM_ISDIGIT(curc) && vim_isfilec(curc);
+ result = !ascii_isdigit(curc) && vim_isfilec(curc);
ADD_STATE_IF_MATCH(t->state);
break;
@@ -5519,7 +5519,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
break;
case NFA_SPRINT: /* \P */
- result = !VIM_ISDIGIT(curc) && vim_isprintc(PTR2CHAR(reginput));
+ result = !ascii_isdigit(curc) && vim_isprintc(PTR2CHAR(reginput));
ADD_STATE_IF_MATCH(t->state);
break;
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 5c4d08ef83..c9a2e147dc 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4977,7 +4977,7 @@ win_redr_custom (
if (*++stl == '-')
stl++;
if (atoi((char *)stl))
- while (VIM_ISDIGIT(*stl))
+ while (ascii_isdigit(*stl))
stl++;
if (*stl++ != '(')
stl = p_ruf;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 72942c589c..24e95efb03 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1006,7 +1006,7 @@ int do_search(
* offset, because it is meaningless and the 's' could be a
* substitute command.
*/
- if (*p == '+' || *p == '-' || VIM_ISDIGIT(*p))
+ if (*p == '+' || *p == '-' || ascii_isdigit(*p))
spats[0].off.line = TRUE;
else if ((options & SEARCH_OPT) &&
(*p == 'e' || *p == 's' || *p == 'b')) {
@@ -1014,16 +1014,16 @@ int do_search(
spats[0].off.end = SEARCH_END;
++p;
}
- if (VIM_ISDIGIT(*p) || *p == '+' || *p == '-') { /* got an offset */
+ if (ascii_isdigit(*p) || *p == '+' || *p == '-') { /* got an offset */
/* 'nr' or '+nr' or '-nr' */
- if (VIM_ISDIGIT(*p) || VIM_ISDIGIT(*(p + 1)))
+ if (ascii_isdigit(*p) || ascii_isdigit(*(p + 1)))
spats[0].off.off = atol((char *)p);
else if (*p == '-') /* single '-' */
spats[0].off.off = -1;
else /* single '+' */
spats[0].off.off = 1;
++p;
- while (VIM_ISDIGIT(*p)) /* skip number */
+ while (ascii_isdigit(*p)) /* skip number */
++p;
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 8cfe1c8c9a..90a2d69703 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -5155,7 +5155,7 @@ static unsigned get_affitem(int flagtype, char_u **pp)
int res;
if (flagtype == AFT_NUM) {
- if (!VIM_ISDIGIT(**pp)) {
+ if (!ascii_isdigit(**pp)) {
++*pp; // always advance, avoid getting stuck
return 0;
}
@@ -5410,7 +5410,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Read and ignore the first line: word count.
(void)vim_fgets(line, MAXLINELEN, fd);
- if (!vim_isdigit(*skipwhite(line)))
+ if (!ascii_isdigit(*skipwhite(line)))
EMSG2(_("E760: No word count in %s"), fname);
// Read all the lines in the file one by one.
@@ -6019,7 +6019,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
flags |= WF_BANNED;
else if (*p == '?') // Rare word.
flags |= WF_RARE;
- else if (VIM_ISDIGIT(*p)) { // region number(s)
+ else if (ascii_isdigit(*p)) { // region number(s)
if ((flags & WF_REGION) == 0) // first one
regionmask = 0;
flags |= WF_REGION;
@@ -6351,20 +6351,20 @@ int spell_check_msm(void)
long incr = 0;
long added = 0;
- if (!VIM_ISDIGIT(*p))
+ if (!ascii_isdigit(*p))
return FAIL;
// block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
start = (getdigits_long(&p) * 10) / (SBLOCKSIZE / 102);
if (*p != ',')
return FAIL;
++p;
- if (!VIM_ISDIGIT(*p))
+ if (!ascii_isdigit(*p))
return FAIL;
incr = (getdigits_long(&p) * 102) / (SBLOCKSIZE / 10);
if (*p != ',')
return FAIL;
++p;
- if (!VIM_ISDIGIT(*p))
+ if (!ascii_isdigit(*p))
return FAIL;
added = getdigits_long(&p) * 1024;
if (*p != NUL)
@@ -8350,10 +8350,10 @@ int spell_check_sps(void)
copy_option_part(&p, buf, MAXPATHL, ",");
f = 0;
- if (VIM_ISDIGIT(*buf)) {
+ if (ascii_isdigit(*buf)) {
s = buf;
sps_limit = getdigits_int(&s);
- if (*s != NUL && !VIM_ISDIGIT(*s))
+ if (*s != NUL && !ascii_isdigit(*s))
f = -1;
} else if (STRCMP(buf, "best") == 0)
f = SPS_BEST;
@@ -11822,7 +11822,7 @@ static void spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res)
}
if (*s == '<')
s++;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
// determine priority
pri = *s - '0';
s++;
@@ -11883,7 +11883,7 @@ static void spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res)
}
if (*s == '<')
s++;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
p0 = *s - '0';
s++;
}
@@ -12076,7 +12076,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
}
if (*s == '<')
s++;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
// determine priority
pri = *s - '0';
s++;
@@ -12141,7 +12141,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
}
if (*s == '<')
s++;
- if (VIM_ISDIGIT(*s)) {
+ if (ascii_isdigit(*s)) {
p0 = *s - '0';
s++;
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 4a0c1dfe79..7e6e247bba 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4968,7 +4968,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
arg_end = key + 11;
else
arg_end = key + 9;
- if (arg_end[-1] != '=' || !VIM_ISDIGIT(*arg_end)) {
+ if (arg_end[-1] != '=' || !ascii_isdigit(*arg_end)) {
illegal = TRUE;
break;
}
@@ -6251,7 +6251,7 @@ do_highlight (
HL_TABLE()[idx].sg_cterm_bold = FALSE;
}
- if (VIM_ISDIGIT(*arg))
+ if (ascii_isdigit(*arg))
color = atoi((char *)arg);
else if (STRICMP(arg, "fg") == 0) {
if (cterm_normal_fg_color)
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 29d3bf27e1..5966efa05d 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -2652,7 +2652,7 @@ static int find_extra(char_u **pp)
/* Repeat for addresses separated with ';' */
for (;; ) {
- if (VIM_ISDIGIT(*str))
+ if (ascii_isdigit(*str))
str = skipdigits(str);
else if (*str == '/' || *str == '?') {
str = skip_regexp(str + 1, *str, FALSE, NULL);
@@ -2663,7 +2663,7 @@ static int find_extra(char_u **pp)
} else
str = NULL;
if (str == NULL || *str != ';'
- || !(VIM_ISDIGIT(str[1]) || str[1] == '/' || str[1] == '?'))
+ || !(ascii_isdigit(str[1]) || str[1] == '/' || str[1] == '?'))
break;
++str; /* skip ';' */
}