]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/strtoumax.c.patch
Libc-391.4.1.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtoumax.c.patch
1 --- strtoumax.c.orig 2003-05-20 15:23:25.000000000 -0700
2 +++ strtoumax.c 2005-02-23 13:24:30.000000000 -0800
3 @@ -37,6 +37,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <ctype.h>
10 #include <errno.h>
11 #include <stdlib.h>
12 @@ -49,7 +51,8 @@
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;
22 @@ -57,13 +60,14 @@
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++;
38 @@ -117,3 +121,9 @@
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 +}