tree-wide: use ALPHANUMERICAL where appropriate

Prompted by 43116c5662
This commit is contained in:
Mike Yuan
2026-03-04 07:36:10 +09:00
committed by Yu Watanabe
parent 3e7b9b7462
commit 085f92730a
6 changed files with 8 additions and 9 deletions
+1 -1
View 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) {
+1 -1
View 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) {
+1 -2
View 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 */
+1 -1
View 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). */
+3 -3
View 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++) = '%';
+1 -1
View 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))