summaryrefslogtreecommitdiff
path: root/libc/misc/wchar/wchar.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-03 10:58:12 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-03 10:58:12 +0000
commitd4db0bd93900e4515a151ff6037b3fc0e1b22140 (patch)
treedc147e5a321894987769e1f51d3ea049d23bd1c2 /libc/misc/wchar/wchar.c
parentb1723348b5583c6eb489cb147994d64fe6923b35 (diff)
When DODEBUG and HAS_WCHAR were enabled and HAS_LOCALE was disabled,
wchar.c wouldn't compile: wchar.c: In function `__mbsnrtowcs': wchar.c:631: `__ctype_encoding_7_bit' undeclared (first use in this function) This fixes it by keeping the locale specific asserts hidden when not relevant. -Erik
Diffstat (limited to 'libc/misc/wchar/wchar.c')
-rw-r--r--libc/misc/wchar/wchar.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 9f08f3312..676147334 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -79,7 +79,6 @@
#warning implement __CTYPE_HAS_UTF_8_LOCALES!
#define __CTYPE_HAS_UTF_8_LOCALES
#else
-#define ENCODING (__ctype_encoding_7_bit)
#undef __CTYPE_HAS_8_BIT_LOCALES
#undef __CTYPE_HAS_UTF_8_LOCALES
#undef L__wchar_utf8sntowcs
@@ -572,7 +571,7 @@ size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
static mbstate_t mbstate; /* Rely on bss 0-init. */
wchar_t wcbuf[1];
const char *s;
- size_t count, r;
+ size_t count;
int incr;
if (!ps) {
@@ -581,6 +580,7 @@ size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
#ifdef __CTYPE_HAS_UTF_8_LOCALES
if (ENCODING == __ctype_encoding_utf8) {
+ size_t r;
return ((r = _wchar_utf8sntowcs(dst, len, src, NMC, ps, 1))
!= (size_t) -2) ? r : 0;
}
@@ -628,7 +628,9 @@ size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
}
#endif
+#ifdef __UCLIBC_HAS_LOCALE__
assert(ENCODING == __ctype_encoding_7_bit);
+#endif
while (count) {
if ((*dst = (unsigned char) *s) == 0) {
@@ -738,7 +740,9 @@ size_t __wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
}
#endif /* __CTYPE_HAS_8_BIT_LOCALES */
+#ifdef __UCLIBC_HAS_LOCALE__
assert(ENCODING == __ctype_encoding_7_bit);
+#endif
while (count) {
if (*s >= 0x80) {