Same as previous, but for _toupper_tab_.
--
Sebastien Marie
Index: b/include/ctype.h
===================================================================
--- a/include/ctype.h 2015-06-30 12:19:07.342557440 +0200
+++ b/include/ctype.h 2015-06-30 12:19:31.892786432 +0200
@@ -55,7 +55,7 @@
extern const char *_ctype_(void);
extern const short *_tolower_tab_;
-extern const short *_toupper_tab_;
+extern const short *_toupper_tab_(void);
#if defined(__GNUC__) || defined(_ANSI_LIBRARY)
int isalnum(int);
@@ -165,7 +165,7 @@
{
if ((unsigned int)_c > 255)
return (_c);
- return ((_toupper_tab_ + 1)[_c]);
+ return ((_toupper_tab_() + 1)[_c]);
}
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
Index: b/lib/libc/gen/toupper_.c
===================================================================
--- a/lib/libc/gen/toupper_.c 2015-06-30 12:00:10.023193401 +0200
+++ b/lib/libc/gen/toupper_.c 2015-06-30 12:19:31.892786432 +0200
@@ -46,13 +46,11 @@
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
-const short *_toupper_tab_ = _C_toupper_;
-
#undef toupper
int
toupper(int c)
{
if ((unsigned int)c > 255)
return(c);
- return((_toupper_tab_ + 1)[c]);
+ return((_toupper_tab_() + 1)[c]);
}
Index: b/lib/libc/locale/runeglue.c
===================================================================
--- a/lib/libc/locale/runeglue.c 2015-06-30 12:19:07.352556508 +0200
+++ b/lib/libc/locale/runeglue.c 2015-06-30 12:19:31.902785988 +0200
@@ -119,13 +119,9 @@
{
if (locale->lc_ctype->rl_tabs != NULL) {
/* LINTED const cast */
- _toupper_tab_ = (const short *)
- &(locale->lc_ctype->rl_tabs->toupper_tab);
- /* LINTED const cast */
_tolower_tab_ = (const short *)
&(locale->lc_ctype->rl_tabs->tolower_tab);
} else {
- _toupper_tab_ = _C_toupper_;
_tolower_tab_ = _C_tolower_;
}
}
Index: b/lib/libc/locale/xlocale.c
===================================================================
--- a/lib/libc/locale/xlocale.c 2015-06-30 12:19:25.942714494 +0200
+++ b/lib/libc/locale/xlocale.c 2015-06-30 12:19:31.902785988 +0200
@@ -41,3 +41,15 @@
else
return (_C_ctype_);
}
+
+/* exported via ctype.h */
+const short *
+_toupper_tab_()
+{
+ locale_t loc = _current_locale();
+
+ if (loc->lc_ctype->rl_tabs != NULL)
+ return (loc->lc_ctype->rl_tabs->toupper_tab);
+ else
+ return (_C_toupper_);
+}