]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/strtoul.c.patch
Libc-498.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtoul.c.patch
1 --- strtoul.c.orig 2003-05-20 15:23:25.000000000 -0700
2 +++ strtoul.c 2005-02-17 12:52:46.000000000 -0800
3 @@ -37,6 +37,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.16 2002/09/06 11:23:59 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <limits.h>
10 #include <ctype.h>
11 #include <errno.h>
12 @@ -49,7 +51,8 @@
13 * alphabets and digits are each contiguous.
14 */
15 unsigned long
16 -strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
17 +strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base,
18 + locale_t loc)
19 {
20 const char *s;
21 unsigned long acc;
22 @@ -57,13 +60,14 @@
23 unsigned long cutoff;
24 int neg, any, cutlim;
25
26 + NORMALIZE_LOCALE(loc);
27 /*
28 * See strtol for comments as to the logic used.
29 */
30 s = nptr;
31 do {
32 c = *s++;
33 - } while (isspace((unsigned char)c));
34 + } while (isspace_l((unsigned char)c, loc));
35 if (c == '-') {
36 neg = 1;
37 c = *s++;
38 @@ -117,3 +121,9 @@
39 *endptr = (char *)(any ? s - 1 : nptr);
40 return (acc);
41 }
42 +
43 +unsigned long
44 +strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
45 +{
46 + return strtoul_l(nptr, endptr, base, __current_locale());
47 +}