summary refs log tree commit diff
path: root/locale/localeinfo.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-05-23 10:08:18 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-05-23 11:06:31 +0200
commit7ee41feba6b834d9e17e634bfbf222c4d8dd1a4f (patch)
treecae31634fe857b963791bf3697bdae20312acc2e /locale/localeinfo.h
parentbbebe83a2874cd25934046d908824dfc11711a2b (diff)
downloadglibc-7ee41feba6b834d9e17e634bfbf222c4d8dd1a4f.tar.gz
glibc-7ee41feba6b834d9e17e634bfbf222c4d8dd1a4f.tar.xz
glibc-7ee41feba6b834d9e17e634bfbf222c4d8dd1a4f.zip
locale: Remove private union from struct __locale_data
This avoids an alias violation later.  This commit also fixes
an incorrect double-checked locking idiom in _nl_init_era_entries.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'locale/localeinfo.h')
-rw-r--r--locale/localeinfo.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 8ce072b7b4..01ec5535bb 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -59,13 +59,13 @@ struct __locale_data
   } alloc;
 
   /* This provides a slot for category-specific code to cache data
-     computed about this locale.  This is deallocated at the start of
-     _nl_unload_locale.  */
-  union
-  {
-    struct lc_time_data *time;
-    const struct gconv_fcts *ctype;
-  } private;
+     computed about this locale.  Type of the data pointed to:
+
+     LC_CTYPE   struct gconv_fcts (get_gconv_fcts, __wcsmbs_load_conv)
+     LC_TIME    struct lc_time_data (_nl_init_alt_digit, _nl_init_era_entries)
+
+     This data deallocated at the start of _nl_unload_locale.  */
+  void *private;
 
   unsigned int usage_count;	/* Counter for users.  */