]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use ALPHANUMERICAL where appropriate
authorMike Yuan <me@yhndnzj.com>
Tue, 3 Mar 2026 21:24:39 +0000 (22:24 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 3 Mar 2026 22:36:10 +0000 (07:36 +0900)
Prompted by 43116c56621c7317852c01e67dbcaa78b5e7ff70

src/basic/env-util.c
src/basic/login-util.c
src/basic/unit-name.c
src/hostname/hostnamed.c
src/import/oci-util.c
src/portable/portablectl.c

index 7964a368db26574d65729136ea7b29cd2b0529df..4f6240e546519413e3f4f0aecd9b59fdac80e612 100644 (file)
@@ -19,7 +19,7 @@
 
 /* We follow bash for the character set. Different shells have different rules. */
 #define VALID_BASH_ENV_NAME_CHARS               \
-        DIGITS LETTERS                          \
+        ALPHANUMERICAL                          \
         "_"
 
 size_t sc_arg_max(void) {
index 926e482fb0eacf4973eceb701a520c8e3328233d..7f9b84be3c1804900364147e5b994d6d37991da9 100644 (file)
@@ -10,7 +10,7 @@ bool session_id_valid(const char *id) {
         if (isempty(id))
                 return false;
 
-        return id[strspn(id, LETTERS DIGITS)] == '\0';
+        return in_charset(id, ALPHANUMERICAL);
 }
 
 bool logind_running(void) {
index 43b3f6831222a4dbdfed45feef07cd0ea044fe2e..8a04638b2f87b2930e26521232deea7a1a0df064 100644 (file)
@@ -17,8 +17,7 @@
 
 /* Characters valid in a unit name. */
 #define VALID_CHARS                             \
-        DIGITS                                  \
-        LETTERS                                 \
+        ALPHANUMERICAL                          \
         ":-_.\\"
 
 /* The same, but also permits the single @ character that may appear */
index a567221f8ea0b93e8124ecffe5a2fc310a186975..04c72e8137bf1e74460aafbc48f7110541a20d9f 100644 (file)
@@ -49,7 +49,7 @@
 #include "varlink-util.h"
 #include "virt.h"
 
-#define VALID_DEPLOYMENT_CHARS (DIGITS LETTERS "-.:")
+#define VALID_DEPLOYMENT_CHARS (ALPHANUMERICAL "-.:")
 
 /* Properties we cache are indexed by an enum, to make invalidation easy and systematic (as we can iterate
  * through them all, and they are uniformly strings). */
index 37a617b28ce1acd5208ea673f19af74387ca9738..96f7729fb6393ed6ef16046680c86373dff0d21c 100644 (file)
@@ -79,10 +79,10 @@ bool oci_tag_is_valid(const char *n) {
          * [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}
          */
 
-        if (!strchr(LETTERS DIGITS "_", n[0]))
+        if (!strchr(ALPHANUMERICAL "_", n[0]))
                 return false;
 
-        size_t l = strspn(n + 1, LETTERS DIGITS "._-");
+        size_t l = strspn(n + 1, ALPHANUMERICAL "._-");
         if (l > 126)
                 return false;
         if (n[1+l] != 0)
@@ -387,7 +387,7 @@ char* urlescape(const char *s) {
 
         char *p = t;
         for (; s && *s; s++) {
-                if (strchr(LETTERS DIGITS ".-_", *s))
+                if (strchr(ALPHANUMERICAL ".-_", *s))
                         *(p++) = *s;
                 else {
                         *(p++) = '%';
index dfe6df3bf310d7fa57e79233ea864f3028a5763f..d277504a8119663744ceb5454161374afc5ae68c 100644 (file)
@@ -155,7 +155,7 @@ static int extract_prefix(const char *path, char **ret) {
 
         /* A slightly reduced version of what's permitted in unit names. With ':' and '\' are removed, as well as '_'
          * which we use as delimiter for the second part of the image string, which we ignore for now. */
-        if (!in_charset(name, DIGITS LETTERS "-."))
+        if (!in_charset(name, ALPHANUMERICAL "-."))
                 return -EINVAL;
 
         if (!filename_is_valid(name))