aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ascii.h
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2015-04-22 19:49:53 -0300
committerFelipe Oliveira Carvalho <felipekde@gmail.com>2015-04-24 20:37:13 -0300
commit2ca8afc74eada76f50ae60dbb0d6f1804d36bed5 (patch)
tree4f272a27dd1d2529382d7d1cc409c988a87b2dee /src/nvim/ascii.h
parentcaabcae0b7470731e793c199b905bfa1bb696914 (diff)
downloadrneovim-2ca8afc74eada76f50ae60dbb0d6f1804d36bed5.tar.gz
rneovim-2ca8afc74eada76f50ae60dbb0d6f1804d36bed5.tar.bz2
rneovim-2ca8afc74eada76f50ae60dbb0d6f1804d36bed5.zip
Replace vim_isxdigit() with to ascii_isxdigit() defined in ascii.h
Diffstat (limited to 'src/nvim/ascii.h')
-rw-r--r--src/nvim/ascii.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h
index 8e51d50426..014cd00706 100644
--- a/src/nvim/ascii.h
+++ b/src/nvim/ascii.h
@@ -92,6 +92,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;
/// ascii_iswhite() is used for "^" and the like. It differs from isspace()
/// because it doesn't include <CR> and <LF> and the like.
@@ -108,5 +109,18 @@ static inline bool ascii_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 hexadecimal digit.
+static inline bool ascii_isxdigit(int c)
+{
+ return (c >= '0' && c <= '9')
+ || (c >= 'a' && c <= 'f')
+ || (c >= 'A' && c <= 'F');
+}
+
#endif /* NVIM_ASCII_H */