From 7ee41feba6b834d9e17e634bfbf222c4d8dd1a4f Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 23 May 2022 10:08:18 +0200 Subject: 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 --- locale/C-address.c | 2 +- locale/C-collate.c | 2 +- locale/C-ctype.c | 2 +- locale/C-identification.c | 2 +- locale/C-measurement.c | 2 +- locale/C-messages.c | 2 +- locale/C-monetary.c | 2 +- locale/C-name.c | 2 +- locale/C-numeric.c | 2 +- locale/C-paper.c | 2 +- locale/C-telephone.c | 2 +- locale/C-time.c | 2 +- locale/localeinfo.h | 14 +++++++------- 13 files changed, 19 insertions(+), 19 deletions(-) (limited to 'locale') diff --git a/locale/C-address.c b/locale/C-address.c index 1f509e4..40ce9fb 100644 --- a/locale/C-address.c +++ b/locale/C-address.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_ADDRESS attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 13, diff --git a/locale/C-collate.c b/locale/C-collate.c index 510e90c..f9c2b77 100644 --- a/locale/C-collate.c +++ b/locale/C-collate.c @@ -25,7 +25,7 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 19, diff --git a/locale/C-ctype.c b/locale/C-ctype.c index cc99bff..ef4b670 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -542,7 +542,7 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 1, /* Enable transliteration by default. */ NR_FIXED + NR_CLASSES + NR_MAPS, diff --git a/locale/C-identification.c b/locale/C-identification.c index edaf417..9648de0 100644 --- a/locale/C-identification.c +++ b/locale/C-identification.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_IDENTIFICATION attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 16, diff --git a/locale/C-measurement.c b/locale/C-measurement.c index b98d624..99e16ca 100644 --- a/locale/C-measurement.c +++ b/locale/C-measurement.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_MEASUREMENT attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 2, diff --git a/locale/C-messages.c b/locale/C-messages.c index 88331c7..8fc5c39 100644 --- a/locale/C-messages.c +++ b/locale/C-messages.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_MESSAGES attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 5, diff --git a/locale/C-monetary.c b/locale/C-monetary.c index 295f7a9..9c752bc 100644 --- a/locale/C-monetary.c +++ b/locale/C-monetary.c @@ -27,7 +27,7 @@ const struct __locale_data _nl_C_LC_MONETARY attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 46, diff --git a/locale/C-name.c b/locale/C-name.c index c9b03ef..0c04b44 100644 --- a/locale/C-name.c +++ b/locale/C-name.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_NAME attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 7, diff --git a/locale/C-numeric.c b/locale/C-numeric.c index 178f61c..6f67dec 100644 --- a/locale/C-numeric.c +++ b/locale/C-numeric.c @@ -23,7 +23,7 @@ const struct __locale_data _nl_C_LC_NUMERIC attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 6, diff --git a/locale/C-paper.c b/locale/C-paper.c index 0682238..56b9519 100644 --- a/locale/C-paper.c +++ b/locale/C-paper.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_PAPER attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 3, diff --git a/locale/C-telephone.c b/locale/C-telephone.c index 7f71f60..1e8e8b7 100644 --- a/locale/C-telephone.c +++ b/locale/C-telephone.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_TELEPHONE attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 5, diff --git a/locale/C-time.c b/locale/C-time.c index ebd7959..78d8704 100644 --- a/locale/C-time.c +++ b/locale/C-time.c @@ -26,7 +26,7 @@ const struct __locale_data _nl_C_LC_TIME attribute_hidden = { _nl_C_name, NULL, 0, 0, /* no file mapped */ - { NULL, }, /* no cached data */ + NULL, /* No cached data. */ UNDELETABLE, 0, 159, diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 8ce072b..01ec553 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. */ -- cgit v1.1