]> git.saurik.com Git - apple/libc.git/blame - stdlib/FreeBSD/strtoull.c.patch
Libc-391.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtoull.c.patch
CommitLineData
3d9156a7
A
1--- strtoull.c.orig 2003-05-20 15:23:25.000000000 -0700
2+++ strtoull.c 2005-02-17 00:52:41.000000000 -0800
3@@ -37,6 +37,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <limits.h>
10 #include <errno.h>
11 #include <ctype.h>
12@@ -49,7 +51,8 @@
13 * alphabets and digits are each contiguous.
14 */
15 unsigned long long
16-strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
17+strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
18+ locale_t loc)
19 {
20 const char *s;
21 unsigned long long acc;
22@@ -57,13 +60,14 @@
23 unsigned long long cutoff;
24 int neg, any, cutlim;
25
26+ NORMALIZE_LOCALE(loc);
27 /*
28 * See strtoq 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 long
44+strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
45+{
46+ return strtoull_l(nptr, endptr, base, __current_locale());
47+}