diff options
| author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2015-04-22 19:47:53 -0300 |
|---|---|---|
| committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2015-04-24 20:37:13 -0300 |
| commit | caabcae0b7470731e793c199b905bfa1bb696914 (patch) | |
| tree | 2015066852ad22ec24353db40d2dc752ccd59ce3 | |
| parent | 93bf201119f68b0723ee3f240afa48134cc41399 (diff) | |
| download | rneovim-caabcae0b7470731e793c199b905bfa1bb696914.tar.gz rneovim-caabcae0b7470731e793c199b905bfa1bb696914.tar.bz2 rneovim-caabcae0b7470731e793c199b905bfa1bb696914.zip | |
Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.h
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) |