Use isdigit() rather than character range comparisons

This is safer and guaranteed to work with even exotic character sets.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2012-01-18 15:32:48 -06:00
parent 7b1a86b893
commit b426488e2b

View file

@ -1085,7 +1085,7 @@ off_t _alpm_strtoofft(const char *line)
errno = 0; errno = 0;
/* we are trying to parse bare numbers only, no leading anything */ /* we are trying to parse bare numbers only, no leading anything */
if(line[0] < '0' || line[0] > '9') { if(!isdigit((unsigned char)line[0])) {
return (off_t)-1; return (off_t)-1;
} }
result = strtoull(line, &end, 10); result = strtoull(line, &end, 10);