summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-14 19:33:11 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-14 19:33:11 -0500
commitc247ebdd989365d20da3ce41fdeb2002e0a1ba13 (patch)
tree8bb6738a2b6e1503b012a995245ae6fbdea2ff6f
parent5377715ce07269131f011e6f4e978fb5dbf0b294 (diff)
downloadmusl-c247ebdd989365d20da3ce41fdeb2002e0a1ba13.tar.gz
musl-c247ebdd989365d20da3ce41fdeb2002e0a1ba13.tar.bz2
musl-c247ebdd989365d20da3ce41fdeb2002e0a1ba13.tar.xz
musl-c247ebdd989365d20da3ce41fdeb2002e0a1ba13.zip
more header fixes, minor warning fix
-rw-r--r--include/wchar.h16
-rw-r--r--include/wctype.h1
-rw-r--r--src/ctype/wcwidth.c1
-rw-r--r--src/stdlib/strtoimax.c4
-rw-r--r--src/stdlib/wcstoimax.c1
-rw-r--r--src/stdlib/wcstoumax.c1
6 files changed, 18 insertions, 6 deletions
diff --git a/include/wchar.h b/include/wchar.h
index 3f325bff..53d619b3 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -10,12 +10,19 @@ extern "C" {
#define __NEED_size_t
#define __NEED_wchar_t
#define __NEED_wint_t
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
#define __NEED_wctype_t
+#endif
#include <bits/alltypes.h>
#undef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
#define NULL ((void*)0)
+#endif
#undef WCHAR_MIN
#undef WCHAR_MAX
@@ -74,9 +81,6 @@ size_t mbrlen (const char *, size_t, mbstate_t *);
size_t mbsrtowcs (wchar_t *, const char **, size_t, mbstate_t *);
size_t wcsrtombs (char *, const wchar_t **, size_t, mbstate_t *);
-int wcwidth (wchar_t);
-int wcswidth (const wchar_t *, size_t);
-
float wcstof (const wchar_t *, wchar_t **);
double wcstod (const wchar_t *, wchar_t **);
long double wcstold (const wchar_t *, wchar_t **);
@@ -126,6 +130,9 @@ size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
#undef iswdigit
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+int wcwidth (wchar_t);
+int wcswidth (const wchar_t *, size_t);
int iswalnum(wint_t);
int iswalpha(wint_t);
int iswblank(wint_t);
@@ -142,8 +149,9 @@ int iswctype(wint_t, wctype_t);
wint_t towlower(wint_t);
wint_t towupper(wint_t);
wctype_t wctype(const char *);
-
+#undef iswdigit
#define iswdigit(a) ((unsigned)(a)-'0' < 10)
+#endif
#ifdef __cplusplus
}
diff --git a/include/wctype.h b/include/wctype.h
index 8b6c9d9d..af9be069 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -35,6 +35,7 @@ wint_t towupper(wint_t);
wctrans_t wctrans(const char *);
wctype_t wctype(const char *);
+#undef iswdigit
#define iswdigit(a) ((unsigned)((a)-L'0') < 10)
#ifdef __cplusplus
diff --git a/src/ctype/wcwidth.c b/src/ctype/wcwidth.c
index ebc560a5..eaafd7cb 100644
--- a/src/ctype/wcwidth.c
+++ b/src/ctype/wcwidth.c
@@ -1,5 +1,6 @@
#include <inttypes.h>
#include <wchar.h>
+#include <wctype.h>
#define R(a,b,w) { (b), (w)/2, (b)-(a) }
diff --git a/src/stdlib/strtoimax.c b/src/stdlib/strtoimax.c
index 19691091..aeb0397f 100644
--- a/src/stdlib/strtoimax.c
+++ b/src/stdlib/strtoimax.c
@@ -4,7 +4,7 @@
intmax_t strtoimax(const char *s1, char **p, int base)
{
- const unsigned char *s = s1;
+ const unsigned char *s = (const void *)s1;
int sign = 0;
uintmax_t x;
@@ -15,7 +15,7 @@ intmax_t strtoimax(const char *s1, char **p, int base)
if (*s == '-') sign = *s++;
else if (*s == '+') s++;
- x = strtoumax(s, p, base);
+ x = strtoumax((const void *)s, p, base);
if (x > INTMAX_MAX) {
if (!sign || -x != INTMAX_MIN)
errno = ERANGE;
diff --git a/src/stdlib/wcstoimax.c b/src/stdlib/wcstoimax.c
index 861fcb54..59894f60 100644
--- a/src/stdlib/wcstoimax.c
+++ b/src/stdlib/wcstoimax.c
@@ -1,4 +1,5 @@
#include <wchar.h>
+#include <wctype.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/src/stdlib/wcstoumax.c b/src/stdlib/wcstoumax.c
index a8f4680f..456ddedd 100644
--- a/src/stdlib/wcstoumax.c
+++ b/src/stdlib/wcstoumax.c
@@ -1,4 +1,5 @@
#include <wchar.h>
+#include <wctype.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>