Use estrtol() instead of atoi()
This commit is contained in:
parent
298703ff2d
commit
b2a0362bf8
4
seq.c
4
seq.c
|
@ -98,7 +98,7 @@ digitsleft(const char *d)
|
||||||
if(*d == '+')
|
if(*d == '+')
|
||||||
d++;
|
d++;
|
||||||
exp = strpbrk(d, "eE");
|
exp = strpbrk(d, "eE");
|
||||||
shift = exp ? atoi(&exp[1]) : 0;
|
shift = exp ? estrtol(&exp[1], 10) : 0;
|
||||||
|
|
||||||
return MAX(0, strspn(d, "-0123456789")+shift);
|
return MAX(0, strspn(d, "-0123456789")+shift);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ digitsright(const char *d)
|
||||||
int shift, after;
|
int shift, after;
|
||||||
|
|
||||||
exp = strpbrk(d, "eE");
|
exp = strpbrk(d, "eE");
|
||||||
shift = exp ? atoi(&exp[1]) : 0;
|
shift = exp ? estrtol(&exp[1], 10) : 0;
|
||||||
after = (d = strchr(d, '.')) ? strspn(&d[1], "0123456789") : 0;
|
after = (d = strchr(d, '.')) ? strspn(&d[1], "0123456789") : 0;
|
||||||
|
|
||||||
return MAX(0, after-shift);
|
return MAX(0, after-shift);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user