diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-11-28 00:48:11 +0000 | 
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-11-28 00:48:11 +0000 | 
| commit | 7e302fc7a2591a1f26d7f94ef7d4292930773148 (patch) | |
| tree | 39609fa880161cf047c27ac96bdf1f70f43a0e14 /lib/libc/stdlib/strtoul.c | |
| parent | d262b81bdb16514d281404c8eac9a9c9165554cf (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdlib/strtoul.c')
| -rw-r--r-- | lib/libc/stdlib/strtoul.c | 22 | 
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c index 1f23368f5cbd..e952663c533e 100644 --- a/lib/libc/stdlib/strtoul.c +++ b/lib/libc/stdlib/strtoul.c @@ -52,13 +52,13 @@ unsigned long  strtoul(nptr, endptr, base)  	const char *nptr;  	char **endptr; -	register int base; +	int base;  { -	register const char *s; -	register unsigned long acc; -	register unsigned char c; -	register unsigned long cutoff; -	register int neg, any, cutlim; +	const char *s; +	unsigned long acc; +	unsigned char c; +	unsigned long cutoff; +	int neg, any, cutlim;  	/*  	 * See strtol for comments as to the logic used. @@ -84,17 +84,15 @@ strtoul(nptr, endptr, base)  	if (base == 0)  		base = c == '0' ? 8 : 10;  	acc = any = 0; -	if (base < 2 || base > 36) +	if (base < 2)  		goto noconv;  	cutoff = ULONG_MAX / base;  	cutlim = ULONG_MAX % base;  	for ( ; ; c = *s++) { -		if (!isascii(c)) -			break; -		if (isdigit(c)) -			c -= '0'; -		else if (isalpha(c)) +		if (isxdigit(c)) +			c = digittoint(c); +		else if (isascii(c) && isalpha(c))  			c -= isupper(c) ? 'A' - 10 : 'a' - 10;  		else  			break;  | 
