]> git.saurik.com Git - apple/libc.git/blame_incremental - stdlib/FreeBSD/strtoll.c.patch
Libc-391.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtoll.c.patch
... / ...
CommitLineData
1--- strtoll.c.orig 2003-05-20 15:23:25.000000000 -0700
2+++ strtoll.c 2005-02-17 00:46:45.000000000 -0800
3@@ -37,6 +37,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 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 long long
16-strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
17+strtoll_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,6 +60,7 @@
23 unsigned long long cutoff;
24 int neg, any, cutlim;
25
26+ NORMALIZE_LOCALE(loc);
27 /*
28 * Skip white space and pick up leading +/- sign if any.
29 * If base is 0, allow 0x for hex and 0 for octal, else
30@@ -65,7 +69,7 @@
31 s = nptr;
32 do {
33 c = *s++;
34- } while (isspace((unsigned char)c));
35+ } while (isspace_l((unsigned char)c, loc));
36 if (c == '-') {
37 neg = 1;
38 c = *s++;
39@@ -139,3 +143,9 @@
40 *endptr = (char *)(any ? s - 1 : nptr);
41 return (acc);
42 }
43+
44+long long
45+strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
46+{
47+ return strtoll_l(nptr, endptr, base, __current_locale());
48+}