string-util: reorder characters in version charset

Let's bring the version string character set into a systematic order,
matching the order in which they appear and are defined in the UAPI.10
specification text.

This makes it easier to compare the relevant functions.
This commit is contained in:
Lennart Poettering
2026-07-14 14:44:01 +02:00
parent 6acae8d17d
commit d9b2960d4d

View File

@@ -1470,17 +1470,18 @@ bool version_is_valid(const char *s) {
return false;
/* This is a superset of the characters used by semver. We additionally allow "_". */
if (!in_charset(s, ALPHANUMERICAL "._-+"))
if (!in_charset(s, ALPHANUMERICAL ".-+_"))
return false;
return true;
}
bool version_is_valid_versionspec(const char *s) {
if (!filename_part_is_valid(s))
return false;
if (!in_charset(s, ALPHANUMERICAL "-.~^"))
if (!in_charset(s, ALPHANUMERICAL ".-~^"))
return false;
return true;