mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 22:50:29 +00:00
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:
@@ -210,7 +210,7 @@ int parse_size(const char *t, uint64_t base, uint64_t *size) {
|
||||
e++;
|
||||
|
||||
/* strtoull() itself would accept space/+/- */
|
||||
if (*e >= '0' && *e <= '9') {
|
||||
if (ascii_isdigit(*e)) {
|
||||
unsigned long long l2;
|
||||
char *e2;
|
||||
|
||||
@@ -599,7 +599,7 @@ int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
|
||||
|
||||
/* accept any number of digits, strtoull is limited to 19 */
|
||||
for (size_t i = 0; i < digits; i++,s++) {
|
||||
if (*s < '0' || *s > '9') {
|
||||
if (!ascii_isdigit(*s)) {
|
||||
if (i == 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user