diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2015-04-22 19:50:52 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2015-04-24 20:37:13 -0300 |
commit | bcfc37ea98136c449077baa8d97e2334da20d9fc (patch) | |
tree | fd409abd34a3e08fcddbbea0c4e07f3ec82c7e23 /src | |
parent | 2ca8afc74eada76f50ae60dbb0d6f1804d36bed5 (diff) | |
download | rneovim-bcfc37ea98136c449077baa8d97e2334da20d9fc.tar.gz rneovim-bcfc37ea98136c449077baa8d97e2334da20d9fc.tar.bz2 rneovim-bcfc37ea98136c449077baa8d97e2334da20d9fc.zip |
Replace vim_isspace() with ascii_isspace() defined in ascii.h
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ascii.h | 8 | ||||
-rw-r--r-- | src/nvim/buffer.c | 2 | ||||
-rw-r--r-- | src/nvim/edit.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 6 | ||||
-rw-r--r-- | src/nvim/getchar.c | 4 | ||||
-rw-r--r-- | src/nvim/mark.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 6 | ||||
-rw-r--r-- | src/nvim/strings.c | 10 | ||||
-rw-r--r-- | src/nvim/tag.c | 4 |
11 files changed, 25 insertions, 27 deletions
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index 014cd00706..1442b2a50c 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -93,6 +93,7 @@ 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; static inline bool ascii_isxdigit(int c) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_CONST; +static inline bool ascii_isspace(int x) 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. @@ -122,5 +123,12 @@ static inline bool ascii_isxdigit(int c) || (c >= 'A' && c <= 'F'); } +/// Vim has its own isspace() function, because on some machines isspace() +/// can't handle characters above 128. +static inline bool ascii_isspace(int x) +{ + return (x >= 9 && x <= 13) || x == ' '; +} + #endif /* NVIM_ASCII_H */ diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index e4c7703d77..1465b13c00 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4075,7 +4075,7 @@ chk_modeline ( prev = -1; for (s = ml_get(lnum); *s != NUL; ++s) { - if (prev == -1 || vim_isspace(prev)) { + if (prev == -1 || ascii_isspace(prev)) { if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0) || STRNCMP(s, "vi:", (size_t)3) == 0) break; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 89970f5965..d19f10f47f 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -7403,13 +7403,13 @@ static int ins_bs(int c, int mode, int *inserted_space_p) dec_cursor(); /* start of word? */ - if (mode == BACKSPACE_WORD && !vim_isspace(gchar_cursor())) { + if (mode == BACKSPACE_WORD && !ascii_isspace(gchar_cursor())) { mode = BACKSPACE_WORD_NOT_SPACE; temp = vim_iswordc(gchar_cursor()); } /* end of word? */ else if (mode == BACKSPACE_WORD_NOT_SPACE - && (vim_isspace(cc = gchar_cursor()) + && (ascii_isspace(cc = gchar_cursor()) || vim_iswordc(cc) != temp)) { if (!revins_on) inc_cursor(); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 52f27cc059..a2577513d4 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1371,7 +1371,7 @@ static char_u *do_one_arg(char_u *str) *p++ = *str; } else { /* An item ends at a space not in backticks */ - if (!inbacktick && vim_isspace(*str)) + if (!inbacktick && ascii_isspace(*str)) break; if (*str == '`') inbacktick ^= TRUE; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b4bd6e1bd5..f76ab923b2 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3718,7 +3718,7 @@ static char_u *getargcmd(char_u **argp) if (*arg == '+') { /* +[command] */ ++arg; - if (vim_isspace(*arg) || *arg == '\0') + if (ascii_isspace(*arg) || *arg == '\0') command = dollar_command; else { command = arg; @@ -3742,7 +3742,7 @@ skip_cmd_arg ( int rembs /* TRUE to halve the number of backslashes */ ) { - while (*p && !vim_isspace(*p)) { + while (*p && !ascii_isspace(*p)) { if (*p == '\\' && p[1] != NUL) { if (rembs) STRMOVE(p, p + 1); diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 3342c92c57..e4c02a0c30 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -792,7 +792,7 @@ getcmdline ( if (has_mbyte) { p = mb_prevptr(ccline.cmdbuff, p); if (c == Ctrl_W) { - while (p > ccline.cmdbuff && vim_isspace(*p)) + while (p > ccline.cmdbuff && ascii_isspace(*p)) p = mb_prevptr(ccline.cmdbuff, p); i = mb_get_class(p); while (p > ccline.cmdbuff && mb_get_class(p) == i) @@ -801,10 +801,10 @@ getcmdline ( p += (*mb_ptr2len)(p); } } else if (c == Ctrl_W) { - while (p > ccline.cmdbuff && vim_isspace(p[-1])) + while (p > ccline.cmdbuff && ascii_isspace(p[-1])) --p; i = vim_iswordc(p[-1]); - while (p > ccline.cmdbuff && !vim_isspace(p[-1]) + while (p > ccline.cmdbuff && !ascii_isspace(p[-1]) && vim_iswordc(p[-1]) == i) --p; } else diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index dd4785b41f..1951cd6737 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3568,7 +3568,7 @@ int check_abbr(int c, char_u *ptr, int col, int mincol) clen = 1; while (p > ptr + mincol) { p = mb_prevptr(ptr, p); - if (vim_isspace(*p) || (!vim_abbr && is_id != vim_iswordp(p))) { + if (ascii_isspace(*p) || (!vim_abbr && is_id != vim_iswordp(p))) { p += (*mb_ptr2len)(p); break; } @@ -3583,7 +3583,7 @@ int check_abbr(int c, char_u *ptr, int col, int mincol) if (col > 1) is_id = vim_iswordc(ptr[col - 2]); } - for (scol = col - 1; scol > 0 && !vim_isspace(ptr[scol - 1]) + for (scol = col - 1; scol > 0 && !ascii_isspace(ptr[scol - 1]) && (vim_abbr || is_id == vim_iswordc(ptr[scol - 1])); --scol) ; } diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 10725ae4e5..ce44149ffa 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -1430,7 +1430,7 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags str = skipwhite(line + 1); str = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE); p = str + STRLEN(str); - while (p != str && (*p == NUL || vim_isspace(*p))) + while (p != str && (*p == NUL || ascii_isspace(*p))) p--; if (*p) p++; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index bcdc79be72..ed320a4851 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3901,7 +3901,7 @@ format_lines ( /* put cursor on last non-space */ State = NORMAL; /* don't go past end-of-line */ coladvance((colnr_T)MAXCOL); - while (curwin->w_cursor.col && vim_isspace(gchar_cursor())) + while (curwin->w_cursor.col && ascii_isspace(gchar_cursor())) dec_cursor(); /* do the formatting, without 'showmode' */ @@ -5007,11 +5007,11 @@ static long line_count_info(char_u *line, long *wc, long *cc, long limit, int eo for (i = 0; i < limit && line[i] != NUL; ) { if (is_word) { - if (vim_isspace(line[i])) { + if (ascii_isspace(line[i])) { words++; is_word = 0; } - } else if (!vim_isspace(line[i])) + } else if (!ascii_isspace(line[i])) is_word = 1; ++chars; i += (*mb_ptr2len)(line + i); diff --git a/src/nvim/strings.c b/src/nvim/strings.c index a1f5b05a56..de70397c30 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -450,16 +450,6 @@ char_u *vim_strrchr(const char_u *string, int c) } /* - * Vim has its own isspace() function, because on some machines isspace() - * can't handle characters above 128. - */ -bool vim_isspace(int x) - FUNC_ATTR_CONST -{ - return (x >= 9 && x <= 13) || x == ' '; -} - -/* * Sort an array of strings. */ diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 5966efa05d..df583c66ef 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -587,7 +587,7 @@ do_tag ( /* skip "file:" without a value (static tag) */ if (STRNCMP(p, "file:", 5) == 0 - && vim_isspace(p[5])) { + && ascii_isspace(p[5])) { p += 5; continue; } @@ -640,7 +640,7 @@ do_tag ( ++p; } /* Remove leading whitespace from pattern */ - while (p != command_end && vim_isspace(*p)) + while (p != command_end && ascii_isspace(*p)) ++p; while (p != command_end) { |