diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/stdlib/integers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stdlib/integers.c b/src/stdlib/integers.c index 86be790d..037aba0f 100644 --- a/src/stdlib/integers.c +++ b/src/stdlib/integers.c @@ -429,22 +429,22 @@ public OptionalInt_t Int$parse(Text_t text, Text_t *remainder) { mpz_t i; int result; if (strncmp(str, "0x", 2) == 0) { - const char *end = str + 2 + strcspn(str + 2, "0123456789abcdefABCDEF"); + const char *end = str + 2 + strspn(str + 2, "0123456789abcdefABCDEF"); if (remainder) *remainder = Text$from_str(end); else if (*end != '\0') return NONE_INT; result = mpz_init_set_str(i, str + 2, 16); } else if (strncmp(str, "0o", 2) == 0) { - const char *end = str + 2 + strcspn(str + 2, "01234567"); + const char *end = str + 2 + strspn(str + 2, "01234567"); if (remainder) *remainder = Text$from_str(end); else if (*end != '\0') return NONE_INT; result = mpz_init_set_str(i, str + 2, 8); } else if (strncmp(str, "0b", 2) == 0) { - const char *end = str + 2 + strcspn(str + 2, "01"); + const char *end = str + 2 + strspn(str + 2, "01"); if (remainder) *remainder = Text$from_str(end); else if (*end != '\0') return NONE_INT; result = mpz_init_set_str(i, str + 2, 2); } else { - const char *end = str + 2 + strcspn(str + 2, "0123456789"); + const char *end = str + 2 + strspn(str + 2, "0123456789"); if (remainder) *remainder = Text$from_str(end); else if (*end != '\0') return NONE_INT; result = mpz_init_set_str(i, str, 10); |
