diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2017-03-27 14:57:11 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2017-03-27 14:57:56 +0100 |
commit | 8caae83d356c80536ac58a84801c861f0e6f0745 (patch) | |
tree | 3f529b40a2675c482f7523c95b27b0c4bf52acf5 /utils | |
parent | 3ec522429ae933a3035c854aa78d136a06dee0db (diff) | |
download | netsurf-8caae83d356c80536ac58a84801c861f0e6f0745.tar.gz netsurf-8caae83d356c80536ac58a84801c861f0e6f0745.tar.bz2 |
ASCII: Split out a-f test.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ascii.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/utils/ascii.h b/utils/ascii.h index 55ca89ca2..6f7bf6d9a 100644 --- a/utils/ascii.h +++ b/utils/ascii.h @@ -111,6 +111,17 @@ static inline bool ascii_is_alphanumerical(char c) } /** + * Test whether a character is 'a' to 'f' (lowercase). + * + * \param[in] c Character to test. + * \return true iff `c` is 'a' to 'f' (lowercase), else false. + */ +static inline bool ascii_is_af_lower(char c) +{ + return (c >= 'a' && c <= 'f'); +} + +/** * Test whether a character is hexadecimal (lower case). * * \param[in] c Character to test. @@ -118,8 +129,7 @@ static inline bool ascii_is_alphanumerical(char c) */ static inline bool ascii_is_hex_lower(char c) { - return (ascii_is_digit(c) || - (c >= 'a' && c <= 'f')); + return (ascii_is_digit(c) || ascii_is_af_lower(c)); } /** @@ -154,7 +164,7 @@ static inline bool ascii_is_hex(char c) { return (ascii_is_digit(c) || ascii_is_af_upper(c) || - (c >= 'a' && c <= 'f')); + ascii_is_af_lower(c)); } /** |