summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-05-16 19:53:09 +0200
committerFlorian Weimer <fweimer@redhat.com>2025-05-16 19:53:09 +0200
commit10a66a8e421b09682b774c795ef1da402235dddc (patch)
treeab533cd7616e52914c29ab9a9ce03aab1e891ff4 /locale
parent579f8668816b35f8302e89e5255aff60b81938df (diff)
Remove <libc-tsd.h>
Use __thread variables directly instead. The macros do not save any typing. It seems unlikely that a future port will lack __thread variable support. Some of the __libc_tsd_* variables are referenced from assembler files, so keep their names. Previously, <libc-tls.h> included <tls.h>, which in turn included <errno.h>, so a few direct includes of <errno.h> are now required. Reviewed-by: Frédéric Bérat <fberat@redhat.com>
Diffstat (limited to 'locale')
-rw-r--r--locale/lc-ctype.c9
-rw-r--r--locale/localeinfo.h6
-rw-r--r--locale/uselocale.c10
3 files changed, 9 insertions, 16 deletions
diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c
index 867f829be5..47be1c9a39 100644
--- a/locale/lc-ctype.c
+++ b/locale/lc-ctype.c
@@ -64,12 +64,9 @@ _nl_postload_ctype (void)
in fact using the global locale. */
if (_NL_CURRENT_LOCALE == &_nl_global_locale)
{
- __libc_tsd_set (const uint16_t *, CTYPE_B,
- (void *) _nl_global_locale.__ctype_b);
- __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
- (void *) _nl_global_locale.__ctype_toupper);
- __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
- (void *) _nl_global_locale.__ctype_tolower);
+ __libc_tsd_CTYPE_B = _nl_global_locale.__ctype_b;
+ __libc_tsd_CTYPE_TOUPPER = _nl_global_locale.__ctype_toupper;
+ __libc_tsd_CTYPE_TOLOWER = _nl_global_locale.__ctype_tolower;
}
#include <shlib-compat.h>
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index ab1b5e5659..40e11865ca 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -236,10 +236,8 @@ extern struct __locale_struct _nl_global_locale attribute_hidden;
/* This fetches the thread-local locale_t pointer, either one set with
uselocale or &_nl_global_locale. */
-#define _NL_CURRENT_LOCALE (__libc_tsd_get (locale_t, LOCALE))
-#include <libc-tsd.h>
-__libc_tsd_define (extern, locale_t, LOCALE)
-
+#define _NL_CURRENT_LOCALE __libc_tsd_LOCALE
+extern __thread locale_t __libc_tsd_LOCALE;
/* For static linking it is desireable to avoid always linking in the code
and data for every category when we can tell at link time that they are
diff --git a/locale/uselocale.c b/locale/uselocale.c
index 606d043d57..5df87a237f 100644
--- a/locale/uselocale.c
+++ b/locale/uselocale.c
@@ -34,7 +34,7 @@ __uselocale (locale_t newloc)
{
const locale_t locobj
= newloc == LC_GLOBAL_LOCALE ? &_nl_global_locale : newloc;
- __libc_tsd_set (locale_t, LOCALE, locobj);
+ __libc_tsd_LOCALE = locobj;
#ifdef NL_CURRENT_INDIRECT
/* Now we must update all the per-category thread-local variables to
@@ -62,11 +62,9 @@ __uselocale (locale_t newloc)
#endif
/* Update the special tsd cache of some locale data. */
- __libc_tsd_set (const uint16_t *, CTYPE_B, (void *) locobj->__ctype_b);
- __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
- (void *) locobj->__ctype_tolower);
- __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
- (void *) locobj->__ctype_toupper);
+ __libc_tsd_CTYPE_B = locobj->__ctype_b;
+ __libc_tsd_CTYPE_TOLOWER = locobj->__ctype_tolower;
+ __libc_tsd_CTYPE_TOUPPER = locobj->__ctype_toupper;
}
return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc;