From 1a7906ae914fd233305fff0acf4b9138ff944209 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 17 May 2016 09:44:32 -0400 Subject: [PATCH] basic: define HEXDIGITS define HEXDIGITS alongside DIGITS, and use it where it's already useful. We'll use it again shortly when parsing MAC addresses. --- src/basic/string-util.h | 1 + src/test/test-fileio.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/basic/string-util.h b/src/basic/string-util.h index ad0c813..139cc8c 100644 --- a/src/basic/string-util.h +++ b/src/basic/string-util.h @@ -37,6 +37,7 @@ #define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS #define ALPHANUMERICAL LETTERS DIGITS +#define HEXDIGITS DIGITS "abcdefABCDEF" #define streq(a,b) (strcmp((a),(b)) == 0) #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index ec9f173..7960976 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -289,7 +289,7 @@ static void test_capeff(void) { assert_se(r == 0); assert_se(*capeff); - p = capeff[strspn(capeff, DIGITS "abcdefABCDEF")]; + p = capeff[strspn(capeff, HEXDIGITS)]; assert_se(!p || isspace(p)); } } -- 2.7.4