aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/nl_langinfo_l.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/locale/nl_langinfo_l.c b/locale/nl_langinfo_l.c
index b9d02aa..2490af4 100644
--- a/locale/nl_langinfo_l.c
+++ b/locale/nl_langinfo_l.c
@@ -20,6 +20,7 @@
#include <locale.h>
#include <errno.h>
#include <stddef.h>
+#include <stdlib.h>
#include "localeinfo.h"
@@ -43,7 +44,21 @@ __nl_langinfo_l (item, l)
if (index == _NL_ITEM_INDEX (_NL_LOCALE_NAME (category)))
return (char *) l->__names[category];
+#if defined NL_CURRENT_INDIRECT
+ /* Make direct reference to every _nl_current_CATEGORY symbol,
+ since we know only at runtime which categories are used. */
+ switch (category)
+ {
+# define DEFINE_CATEGORY(category, category_name, items, a) \
+ case category: data = *_nl_current_##category; break;
+# include "categories.def"
+# undef DEFINE_CATEGORY
+ default: /* Should be impossible. */
+ abort();
+ }
+#else
data = l->__locales[category];
+#endif
if (index >= data->nstrings)
/* Bogus index for this category: bogus item. */