mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-01 21:51:40 +02:00
Use idigit() instead of range-checking '0' - '9'.
This commit is contained in:
parent
8c3234fb73
commit
87f010ec1a
4 changed files with 8 additions and 9 deletions
|
@ -605,7 +605,7 @@ static unsigned long getnumeric(char *p, int *errp)
|
|||
{
|
||||
unsigned long ret;
|
||||
|
||||
if(*p < '0' || *p > '9') {
|
||||
if (!idigit(*p)) {
|
||||
*errp = 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ math_string(UNUSED(char *name), char *arg, int id)
|
|||
unsigned short *seedptr = seedbufptr + i;
|
||||
*seedptr = 0;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (*seedstr >= '0' && *seedstr <= '9')
|
||||
if (idigit(*seedstr))
|
||||
*seedptr += *seedstr - '0';
|
||||
else if (tolower(*seedstr) >= 'a' &&
|
||||
tolower(*seedstr) <= 'f')
|
||||
|
|
|
@ -573,8 +573,8 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
|
|||
if ((right = (*++s == '-')))
|
||||
s++;
|
||||
|
||||
if (*s >= '0' && *s <= '9') {
|
||||
for (min = 0; *s >= '0' && *s <= '9'; s++)
|
||||
if (idigit(*s)) {
|
||||
for (min = 0; idigit(*s); s++)
|
||||
min = (min * 10) + (int) STOUC(*s) - '0';
|
||||
}
|
||||
|
||||
|
@ -586,8 +586,8 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
|
|||
right = 1;
|
||||
s++;
|
||||
}
|
||||
if ((*s == '.' || testit) && s[1] >= '0' && s[1] <= '9') {
|
||||
for (max = 0, s++; *s >= '0' && *s <= '9'; s++)
|
||||
if ((*s == '.' || testit) && idigit(s[1])) {
|
||||
for (max = 0, s++; idigit(*s); s++)
|
||||
max = (max * 10) + (int) STOUC(*s) - '0';
|
||||
}
|
||||
else if (testit)
|
||||
|
@ -714,8 +714,7 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
|||
specs[')'] = ")";
|
||||
for (ap = args + 2; *ap; ap++) {
|
||||
if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' ||
|
||||
(ap[0][0] >= '0' && ap[0][0] <= '9') ||
|
||||
ap[0][1] != ':') {
|
||||
idigit(ap[0][0]) || ap[0][1] != ':') {
|
||||
zwarnnam(nam, "invalid argument: %s", *ap, 0);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1683,7 +1683,7 @@ ca_inactive(Cadef d, char **xor, int cur, int opts, char *optname)
|
|||
} else if (x[0] == '*' && !x[1]) {
|
||||
if (d->rest && (!set || d->rest->set))
|
||||
d->rest->active = 0;
|
||||
} else if (x[0] >= '0' && x[0] <= '9') {
|
||||
} else if (idigit(x[0])) {
|
||||
int n = atoi(x);
|
||||
Caarg a = d->args;
|
||||
|
||||
|
|
Loading…
Reference in a new issue