commit 73839e34a644fc95a9bc44603025b75aee74ef5b
parent 739ec00a0230c1b94b09750c2f1c0c095fce0295
Author: sin <sin@2f30.org>
Date: Wed, 1 Apr 2015 12:41:08 +0100
Add feature-test guards for mbsnrtowcs() and wcsnrtombs()
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/wchar.h b/include/wchar.h
@@ -11,7 +11,6 @@ extern "C" {
#endif
#undef fgetws
-#undef mbsnrtowcs
#undef mbsrtowcs
#undef mbstowcs
#undef wcrtomb
@@ -19,7 +18,6 @@ extern "C" {
#undef wcscpy
#undef wcsncat
#undef wcsncpy
-#undef wcsnrtombs
#undef wcsrtombs
#undef wcstombs
#undef wctomb
@@ -38,6 +36,9 @@ wchar_t *fgetws(wchar_t *s, int n, FILE *fp)
return __fgetws_orig(s, n, fp);
}
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#undef mbsnrtowcs
__typeof__(mbsnrtowcs) __mbsnrtowcs_orig __asm__(__USER_LABEL_PREFIX__ "mbsnrtowcs");
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
size_t mbsnrtowcs(wchar_t *d, const char **s, size_t n, size_t wn, mbstate_t *st)
@@ -57,6 +58,7 @@ size_t mbsnrtowcs(wchar_t *d, const char **s, size_t n, size_t wn, mbstate_t *st
}
return r;
}
+#endif
__typeof__(mbsrtowcs) __mbsrtowcs_orig __asm__(__USER_LABEL_PREFIX__ "mbsrtowcs");
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
@@ -145,6 +147,9 @@ wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
return __wcsncpy_orig(d, s, n);
}
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#undef wcsnrtombs
__typeof__(wcsnrtombs) __wcsnrtombs_orig __asm__(__USER_LABEL_PREFIX__ "wcsnrtombs");
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
size_t wcsnrtombs(char *d, const wchar_t **s, size_t wn, size_t n, mbstate_t *st)
@@ -164,6 +169,7 @@ size_t wcsnrtombs(char *d, const wchar_t **s, size_t wn, size_t n, mbstate_t *st
}
return r;
}
+#endif
__typeof__(wcsrtombs) __wcsrtombs_orig __asm__(__USER_LABEL_PREFIX__ "wcsrtombs");
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))