diff options
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r-- | src/nvim/charset.c | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 4633bacb78..da65839353 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); @@ -1407,7 +1407,7 @@ void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, char_u* skipwhite(char_u *q) { char_u *p = q; - while (vim_iswhite(*p)) { + while (ascii_iswhite(*p)) { // skip to next non-white 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++; } @@ -1438,7 +1438,7 @@ char_u* skipdigits(char_u *q) char_u* skiphex(char_u *q) { char_u *p = q; - while (vim_isxdigit(*p)) { + while (ascii_isxdigit(*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++; } @@ -1468,40 +1468,13 @@ char_u* skiptodigit(char_u *q) char_u* skiptohex(char_u *q) { char_u *p = q; - while (*p != NUL && !vim_isxdigit(*p)) { + while (*p != NUL && !ascii_isxdigit(*p)) { // skip to next digit p++; } 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. -/// -/// @param c -/// -/// @return TRUE if the character is a digit. -int vim_isxdigit(int c) -{ - return (c >= '0' && c <= '9') - || (c >= 'a' && c <= 'f') - || (c >= 'A' && c <= 'F'); -} - // Vim's own character class functions. These exist because many library // islower()/toupper() etc. do not work properly: they crash when used with // invalid values or can't handle latin1 when the locale is C. @@ -1764,7 +1737,7 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex, if (dohex && ((hex == 'X') || (hex == 'x')) - && vim_isxdigit(ptr[2])) { + && ascii_isxdigit(ptr[2])) { // hexadecimal ptr += 2; } else { @@ -1773,7 +1746,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; @@ -1798,13 +1771,13 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex, } } else if ((hex != 0) || (dohex > 1)) { // hex - while (vim_isxdigit(*ptr)) { + while (ascii_isxdigit(*ptr)) { un = 16 * un + (unsigned long)hex2nr(*ptr); ptr++; } } else { // decimal - while (VIM_ISDIGIT(*ptr)) { + while (ascii_isdigit(*ptr)) { un = 10 * un + (unsigned long)(*ptr - '0'); ptr++; } |