]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
1 | --- strtoumax.c.bsdnew 2009-11-13 14:11:52.000000000 -0800 |
2 | +++ strtoumax.c 2009-11-13 14:11:52.000000000 -0800 | |
3 | @@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtoul | |
3d9156a7 | 4 | #include <sys/cdefs.h> |
1f2f436a | 5 | __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $"); |
3d9156a7 A |
6 | |
7 | +#include "xlocale_private.h" | |
8 | + | |
9 | #include <ctype.h> | |
10 | #include <errno.h> | |
11 | #include <stdlib.h> | |
1f2f436a | 12 | @@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/ |
3d9156a7 A |
13 | * alphabets and digits are each contiguous. |
14 | */ | |
15 | uintmax_t | |
16 | -strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base) | |
17 | +strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base, | |
18 | + locale_t loc) | |
19 | { | |
20 | const char *s; | |
21 | uintmax_t acc; | |
1f2f436a | 22 | @@ -53,13 +56,14 @@ strtoumax(const char * __restrict nptr, |
3d9156a7 A |
23 | uintmax_t cutoff; |
24 | int neg, any, cutlim; | |
25 | ||
26 | + NORMALIZE_LOCALE(loc); | |
27 | /* | |
28 | * See strtoimax 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++; | |
1f2f436a | 38 | @@ -116,3 +120,9 @@ noconv: |
3d9156a7 A |
39 | *endptr = (char *)(any ? s - 1 : nptr); |
40 | return (acc); | |
41 | } | |
42 | + | |
43 | +uintmax_t | |
44 | +strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base) | |
45 | +{ | |
46 | + return strtoumax_l(nptr, endptr, base, __current_locale()); | |
47 | +} |