summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2016-05-17 09:44:32 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2016-05-17 16:55:20 -0400
commit1a7906ae914fd233305fff0acf4b9138ff944209 (patch)
treeab444822e5a80abe8cbd6966ea6238acee4a4e20
parent87c7c9d75e8f5f671824deb0dcc4d05f4b4ab11b (diff)
downloadsystemd-1a7906ae914fd233305fff0acf4b9138ff944209.tar.gz
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.
-rw-r--r--src/basic/string-util.h1
-rw-r--r--src/test/test-fileio.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index ad0c813761..139cc8c91b 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 ec9f173da2..79609765e0 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));
}
}