summaryrefslogtreecommitdiff
path: root/libc/stdlib/stdlib.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-08-24 03:49:13 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-08-24 03:49:13 +0000
commit50660812be5588036a14fc85af16bccef68fac02 (patch)
tree65f25cc1dda3c7efc76efee2c61b28973465db2a /libc/stdlib/stdlib.c
parent02f74937667727e32c591afe42e90e2b515ab61e (diff)
Fix a few bugs in the new extended locale functions.
Move stub gettext functions to a stub libintl to make switching in gnu gettext easier. Also add a few gnu-isms. Change to using hidden names with global weak aliases for the extended locale functions, as expected by libstd++. Slightly rework the locale data generation stuff to allow pregenerated locale data to be used with buildroot.
Diffstat (limited to 'libc/stdlib/stdlib.c')
-rw-r--r--libc/stdlib/stdlib.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 68b1af8b7..c31f5f251 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -299,9 +299,11 @@ strong_alias(__XL(strtol),__XL(strtoll))
long __XL(strtol)(const char * __restrict str, char ** __restrict endptr,
int base __LOCALE_PARAM )
{
- return __XL(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG );
}
+__XL_ALIAS(strtol)
+
#endif
/**********************************************************************/
#if defined(L_strtoll) || defined(L_strtoll_l)
@@ -319,10 +321,12 @@ long long __XL(strtoll)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return (long long) __XL(_stdlib_strto_ll)(str, endptr, base, 1
- __LOCALE_ARG );
+ return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1
+ __LOCALE_ARG );
}
+__XL_ALIAS(strtoll)
+
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
#endif
@@ -341,9 +345,11 @@ unsigned long __XL(strtoul)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return __XL(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG );
}
+__XL_ALIAS(strtoul)
+
#endif
/**********************************************************************/
#if defined(L_strtoull) || defined(L_strtoull_l)
@@ -361,9 +367,11 @@ unsigned long long __XL(strtoull)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return __XL(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
+__XL_ALIAS(strtoull)
+
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
#endif
@@ -432,9 +440,9 @@ unsigned long _stdlib_strto_l(register const Wchar * __restrict str,
/* This is the main work fuction which handles both strtol (sflag = 1) and
* strtoul (sflag = 0). */
-unsigned long __XL(_stdlib_strto_l)(register const Wchar * __restrict str,
- Wchar ** __restrict endptr, int base,
- int sflag __LOCALE_PARAM )
+unsigned long __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str,
+ Wchar ** __restrict endptr, int base,
+ int sflag __LOCALE_PARAM )
{
unsigned long number, cutoff;
#if _STRTO_ENDPTR
@@ -575,9 +583,9 @@ unsigned long long _stdlib_strto_ll(register const Wchar * __restrict str,
/* This is the main work fuction which handles both strtoll (sflag = 1) and
* strtoull (sflag = 0). */
-unsigned long long __XL(_stdlib_strto_ll)(register const Wchar * __restrict str,
- Wchar ** __restrict endptr, int base,
- int sflag __LOCALE_PARAM )
+unsigned long long __XL_NPP(_stdlib_strto_ll)(register const Wchar * __restrict str,
+ Wchar ** __restrict endptr, int base,
+ int sflag __LOCALE_PARAM )
{
unsigned long long number;
#if _STRTO_ENDPTR
@@ -956,9 +964,11 @@ strong_alias(__XL(wcstol),__XL(wcstoll))
long __XL(wcstol)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base __LOCALE_PARAM )
{
- return __XL(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG );
}
+__XL_ALIAS(wcstol)
+
#endif
/**********************************************************************/
#if defined(L_wcstoll) || defined(L_wcstoll_l)
@@ -976,10 +986,12 @@ long long __XL(wcstoll)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return (long long) __XL(_stdlib_wcsto_ll)(str, endptr, base, 1
- __LOCALE_ARG );
+ return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1
+ __LOCALE_ARG );
}
+__XL_ALIAS(wcstoll)
+
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
#endif
@@ -998,9 +1010,11 @@ unsigned long __XL(wcstoul)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return __XL(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG );
}
+__XL_ALIAS(wcstoul)
+
#endif
/**********************************************************************/
#if defined(L_wcstoull) || defined(L_wcstoull_l)
@@ -1018,9 +1032,11 @@ unsigned long long __XL(wcstoull)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
{
- return __XL(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG );
+ return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
+__XL_ALIAS(wcstoull)
+
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
#endif