28 lines
1.0 KiB
Diff
28 lines
1.0 KiB
Diff
|
From 2241ee9563bbcb8bf729547926133619d4baa0cd Mon Sep 17 00:00:00 2001
|
||
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||
|
Date: Thu, 8 Dec 2022 14:13:47 +0900
|
||
|
Subject: [PATCH] string-util: introduce ascii_ishex()
|
||
|
|
||
|
(cherry picked from commit 0ce8870f19a839c7b09b4ef5b61c2d363050c7d9)
|
||
|
|
||
|
Related: RHEL-27512
|
||
|
---
|
||
|
src/fundamental/string-util-fundamental.h | 4 ++++
|
||
|
1 file changed, 4 insertions(+)
|
||
|
|
||
|
diff --git a/src/fundamental/string-util-fundamental.h b/src/fundamental/string-util-fundamental.h
|
||
|
index 523c612a17..c35ce5b88f 100644
|
||
|
--- a/src/fundamental/string-util-fundamental.h
|
||
|
+++ b/src/fundamental/string-util-fundamental.h
|
||
|
@@ -110,6 +110,10 @@ static inline bool ascii_isdigit(sd_char a) {
|
||
|
return a >= '0' && a <= '9';
|
||
|
}
|
||
|
|
||
|
+static inline bool ascii_ishex(sd_char a) {
|
||
|
+ return ascii_isdigit(a) || (a >= 'a' && a <= 'f') || (a >= 'A' && a <= 'F');
|
||
|
+}
|
||
|
+
|
||
|
static inline bool ascii_isalpha(sd_char a) {
|
||
|
/* A pure ASCII, locale independent version of isalpha() */
|
||
|
return (a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z');
|