X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/locale/FreeBSD/wcstol.c diff --git a/locale/FreeBSD/wcstol.c b/locale/FreeBSD/wcstol.c index 7c2afbd..2509e55 100644 --- a/locale/FreeBSD/wcstol.c +++ b/locale/FreeBSD/wcstol.c @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp E * Convert a string to a long integer. */ long -wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) +wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base, locale_t loc) { const wchar_t *s; unsigned long acc; @@ -48,13 +51,14 @@ wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) unsigned long cutoff; int neg, any, cutlim; + NORMALIZE_LOCALE(loc); /* * See strtol for comments as to the logic used. */ s = nptr; do { c = *s++; - } while (iswspace(c)); + } while (iswspace_l(c, loc)); if (c == '-') { neg = 1; c = *s++; @@ -81,8 +85,8 @@ wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) cutoff /= base; for ( ; ; c = *s++) { #ifdef notyet - if (iswdigit(c)) - c = digittoint(c); + if (iswdigit_l(c, loc)) + c = digittoint_l(c, loc); else #endif if (c >= L'0' && c <= L'9') @@ -115,3 +119,9 @@ noconv: *endptr = (wchar_t *)(any ? s - 1 : nptr); return (acc); } + +long +wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) +{ + return wcstol_l(nptr, endptr, base, __current_locale()); +}