From cd46bde2a08e7a5bf4a935784a83dcd246762764 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Mon, 1 Sep 2003 18:32:22 +0000 Subject: Hack around bg_BG bug; grouping specified but no thousands separator. Also, disable the locale link_warnings for now, as they generate a lot of noise when using libstd++. --- libc/misc/locale/locale.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libc/misc/locale') diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index cbed01146..1e79204c0 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -32,6 +32,11 @@ * Bug in duplocale... collation data wasn't copied. * Bug in newlocale... translate 1< #include +#ifdef __UCLIBC_MJN3_ONLY__ +#ifdef L_setlocale +#warning TODO: Make the link_warning()s a config option? +#endif +#endif +#undef link_warning +#define link_warning(A,B) + #undef __LOCALE_C_ONLY #ifndef __UCLIBC_HAS_LOCALE__ #define __LOCALE_C_ONLY @@ -778,8 +791,19 @@ int _locale_set_l(const unsigned char *p, __locale_t base) base->thousands_sep_len = __locale_mbrtowc_l(&base->thousands_sep_wc, base->thousands_sep, base); +#if 1 +#ifdef __UCLIBC_MJN3_ONLY__ +#warning TODO: Remove hack involving grouping without a thousep char (bg_BG). +#endif + assert(base->thousands_sep_len >= 0); + if (base->thousands_sep_len == 0) { + base->grouping = base->thousands_sep; /* empty string */ + } + assert(base->thousands_sep[base->thousands_sep_len] == 0); +#else assert(base->thousands_sep_len > 0); assert(base->thousands_sep[base->thousands_sep_len] == 0); +#endif } /* } else if (i == LC_COLLATE) { */ -- cgit v1.2.3