-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <alloca.h>
#include <argz.h>
/* Define an array of category names (also the environment variable names). */
-const union catnamestr_t _nl_category_names attribute_hidden =
+const struct catnamestr_t _nl_category_names attribute_hidden =
{
- {
#define DEFINE_CATEGORY(category, category_name, items, a) \
- category_name,
+ category_name,
#include "categories.def"
#undef DEFINE_CATEGORY
- }
};
const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
{
#define DEFINE_CATEGORY(category, category_name, items, a) \
- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
+ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)),
#include "categories.def"
#undef DEFINE_CATEGORY
};
/* Construct a new composite name. */
static char *
-new_composite_name (int category, const char *newnames[__LC_LAST])
+new_composite_name (int category, const char **newnames)
{
size_t last_len = 0;
size_t cumlen = 0;
const char *name = (category == LC_ALL ? newnames[i]
: category == i ? newnames[0]
: _nl_global_locale.__names[i]);
- p = __stpcpy (p, _nl_category_names.str + _nl_category_name_idxs[i]);
+ p = __stpcpy (p, _nl_category_names_get (i));
*p++ = '=';
p = __stpcpy (p, name);
*p++ = ';';
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL
&& (size_t) (cp - np) == _nl_category_name_sizes[cnt]
- && (memcmp (np, (_nl_category_names.str
- + _nl_category_name_idxs[cnt]), cp - np)
+ && (memcmp (np, (_nl_category_names_get (cnt)), cp - np)
== 0))
break;
}
libc_hidden_def (setlocale)
-static void __libc_freeres_fn_section
+static void
free_category (int category,
struct __locale_data *here, struct __locale_data *c_data)
{
struct __locale_data *data = (struct __locale_data *) runp->data;
if (data != NULL && data != c_data)
- _nl_unload_locale (data);
+ _nl_unload_locale (category, data);
runp = runp->next;
free ((char *) curr->filename);
free (curr);
/* This is called from iconv/gconv_db.c's free_mem, as locales must
be freed before freeing gconv steps arrays. */
-void __libc_freeres_fn_section
+void
_nl_locale_subfreeres (void)
{
#ifdef NL_CURRENT_INDIRECT