aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ascii.h
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/nvim/ascii.h
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/nvim/ascii.h')
-rw-r--r--src/nvim/ascii.h10
1 files changed, 10 insertions, 0 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 */