summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/stdlib.c')
-rw-r--r--libc/stdlib/stdlib.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 0ebe3b9f9..3c74be71a 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -65,7 +65,7 @@
#ifdef L_wcstoul
#define wcstoull __ignore_wcstoull
#endif
-#ifdef strtol_l
+#ifdef L_strtol_l
#define strtoll_l __ignore_strtoll_l
#endif
#ifdef L_strtoul_l
@@ -344,7 +344,7 @@ strong_alias(strtol,strtoimax)
#else
#undef strtoll
#endif
-extern __typeof(strtol) __XL_NPP(strtoll);
+extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll);
libc_hidden_proto(__XL_NPP(strtoll))
strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
libc_hidden_def(__XL_NPP(strtoll))
@@ -397,7 +397,7 @@ strong_alias(strtoul,strtoumax)
#else
#undef strtoull
#endif
-extern __typeof(strtoul) __XL_NPP(strtoull);
+extern __typeof(__XL_NPP(strtoul)) __XL_NPP(strtoull);
libc_hidden_proto(__XL_NPP(strtoull))
strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
libc_hidden_def(__XL_NPP(strtoull))
@@ -931,15 +931,14 @@ libc_hidden_def(_stdlib_mb_cur_max)
#endif
#ifdef __UCLIBC_HAS_LOCALE__
-/*
+/*
* The following function return 1 if the encoding is stateful, 0 if stateless.
* To note, until now all the supported encoding are stateless.
*/
-
-static inline int
-is_stateful(unsigned char encoding)
+
+static __always_inline int is_stateful(unsigned char encoding)
{
- switch (encoding)
+ switch (encoding)
{
case __ctype_encoding_7_bit:
case __ctype_encoding_utf8:
@@ -966,16 +965,17 @@ int mblen(register const char *s, size_t n)
if (!s) {
state.__mask = 0;
-/* In this case we have to return 0 because the only multibyte supported encoding
- is utf-8, that is a stateless encoding. See mblen() documentation.*/
-
+ /*
+ In this case we have to return 0 because the only multibyte supported encoding
+ is utf-8, that is a stateless encoding. See mblen() documentation.
+ */
return is_stateful(ENCODING);
}
if (*s == '\0')
- /* According to the ISO C 89 standard this is the expected behaviour. */
+ /* According to the ISO C 89 standard this is the expected behaviour. */
return 0;
-
+
if ((r = mbrlen(s, n, &state)) == (size_t) -2) {
/* TODO: Should we set an error state? */
state.__wc = 0xffffU; /* Make sure we're in an error state. */
@@ -997,16 +997,18 @@ int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
if (!s) {
state.__mask = 0;
-/* In this case we have to return 0 because the only multibyte supported encoding
- is utf-8, that is a stateless encoding. See mbtowc() documentation.*/
+ /*
+ In this case we have to return 0 because the only multibyte supported encoding
+ is utf-8, that is a stateless encoding. See mbtowc() documentation.
+ */
return is_stateful(ENCODING);
}
if (*s == '\0')
- /* According to the ISO C 89 standard this is the expected behaviour. */
+ /* According to the ISO C 89 standard this is the expected behaviour. */
return 0;
-
+
if ((r = mbrtowc(pwc, s, n, &state)) == (size_t) -2) {
/* TODO: Should we set an error state? */
state.__wc = 0xffffU; /* Make sure we're in an error state. */
@@ -1027,8 +1029,10 @@ int wctomb(register char *__restrict s, wchar_t swc)
{
return (!s)
?
-/* In this case we have to return 0 because the only multibyte supported encoding
- is utf-8, that is a stateless encoding. See wctomb() documentation.*/
+ /*
+ In this case we have to return 0 because the only multibyte supported encoding
+ is utf-8, that is a stateless encoding. See wctomb() documentation.
+ */
is_stateful(ENCODING)
: ((ssize_t) wcrtomb(s, swc, NULL));
@@ -1086,7 +1090,7 @@ strong_alias(wcstol,wcstoimax)
#else
#undef wcstoll
#endif
-extern __typeof(wcstol) __XL_NPP(wcstoll);
+extern __typeof(__XL_NPP(wcstol)) __XL_NPP(wcstoll);
libc_hidden_proto(__XL_NPP(wcstoll))
strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll))
libc_hidden_def(__XL_NPP(wcstoll))
@@ -1139,7 +1143,7 @@ strong_alias(wcstoul,wcstoumax)
#else
#undef wcstoull
#endif
-extern __typeof(wcstoul) __XL_NPP(wcstoull);
+extern __typeof(__XL_NPP(wcstoul)) __XL_NPP(wcstoull);
libc_hidden_proto(__XL_NPP(wcstoull))
strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
libc_hidden_def(__XL_NPP(wcstoull))