tree-wide: add global ascii_isdigit() + ascii_isalpha()

We now have a local implementation in string-util-fundamental.c, but
it's useful at a lot of other places, hence let's give it a more
expressive name and share it across the tree.

Follow-up for: 8d9156660d
This commit is contained in:
Lennart Poettering
2022-07-05 14:25:07 +02:00
parent 82c3a0b74c
commit ff25d3385d
25 changed files with 68 additions and 89 deletions
+3 -5
View File
@@ -26,12 +26,10 @@ char *bus_label_escape(const char *s) {
for (f = s, t = r; *f; f++) {
/* Escape everything that is not a-zA-Z0-9. We also
* escape 0-9 if it's the first character */
/* Escape everything that is not a-zA-Z0-9. We also escape 0-9 if it's the first character */
if (!(*f >= 'A' && *f <= 'Z') &&
!(*f >= 'a' && *f <= 'z') &&
!(f > s && *f >= '0' && *f <= '9')) {
if (!ascii_isalpha(*f) &&
!(f > s && ascii_isdigit(*f))) {
*(t++) = '_';
*(t++) = hexchar(*f >> 4);
*(t++) = hexchar(*f);