]> git.saurik.com Git - apple/libc.git/blame_incremental - locale/FreeBSD/wcstoll.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / wcstoll.c.patch
... / ...
CommitLineData
1--- wcstoll.c.orig Tue May 20 15:21:45 2003
2+++ wcstoll.c Fri Feb 18 14:54:25 2005
3@@ -40,6 +40,8 @@
4 #endif
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoll.c,v 1.1 2002/09/22 08:06:45 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <errno.h>
10 #include <limits.h>
11 #include <stdlib.h>
12@@ -50,7 +52,8 @@
13 * Convert a wide character string to a long long integer.
14 */
15 long long
16-wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
17+wcstoll_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
18+ int base, locale_t loc)
19 {
20 const wchar_t *s;
21 unsigned long long acc;
22@@ -58,13 +61,14 @@
23 unsigned long long cutoff;
24 int neg, any, cutlim;
25
26+ NORMALIZE_LOCALE(loc);
27 /*
28 * See strtoll for comments as to the logic used.
29 */
30 s = nptr;
31 do {
32 c = *s++;
33- } while (iswspace(c));
34+ } while (iswspace_l(c, loc));
35 if (c == L'-') {
36 neg = 1;
37 c = *s++;
38@@ -91,8 +95,8 @@
39 cutoff /= base;
40 for ( ; ; c = *s++) {
41 #ifdef notyet
42- if (iswdigit(c))
43- c = digittoint(c);
44+ if (iswdigit_l(c, loc))
45+ c = digittoint_l(c, loc);
46 else
47 #endif
48 if (c >= L'0' && c <= L'9')
49@@ -124,4 +128,10 @@
50 if (endptr != NULL)
51 *endptr = (wchar_t *)(any ? s - 1 : nptr);
52 return (acc);
53+}
54+
55+long long
56+wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
57+{
58+ return wcstoll_l(nptr, endptr, base, __current_locale());
59 }