From d4db0bd93900e4515a151ff6037b3fc0e1b22140 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 3 Aug 2002 10:58:12 +0000 Subject: 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 --- libc/misc/wchar/wchar.c | 8 ++++++-- 1 file 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) { -- cgit v1.2.3