aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/reader.c b/src/reader.c
index d2e10f69..a1c517e3 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -253,11 +253,10 @@ static inline uint8_t
read_HEX(SerdReader* reader)
{
const uint8_t c = peek_byte(reader);
- if (is_digit(c) || in_range(c, 'A', 'F') || in_range(c, 'a', 'f')) {
- return eat_byte_safe(reader, c);
- }
- return r_err(reader, SERD_ERR_BAD_SYNTAX,
- "invalid hexadecimal digit `%c'\n", c);
+ return is_xdigit(c)
+ ? eat_byte_safe(reader, c)
+ : r_err(reader, SERD_ERR_BAD_SYNTAX,
+ "invalid hexadecimal digit `%c'\n", c);
}
// Read UCHAR escape, initial \ is already eaten by caller