diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-05-23 10:08:18 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-05-23 11:06:31 +0200 |
commit | bbebe83a2874cd25934046d908824dfc11711a2b (patch) | |
tree | 1e4b6818e4fc8c35996da79471d55048095f7650 /locale/loadlocale.c | |
parent | 0b6342e769be6903f29da067f5cbcbfcc7c01b10 (diff) | |
download | glibc-bbebe83a2874cd25934046d908824dfc11711a2b.tar.gz glibc-bbebe83a2874cd25934046d908824dfc11711a2b.tar.xz glibc-bbebe83a2874cd25934046d908824dfc11711a2b.zip |
locale: Remove cleanup function pointer from struct __localedata
We can call the cleanup functions directly from _nl_unload_locale if we pass the category to it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'locale/loadlocale.c')
-rw-r--r-- | locale/loadlocale.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c index b8cd1aa441..9069bafcd8 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -101,8 +101,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize) newdata->filedata = (void *) filedata; newdata->filesize = datasize; - newdata->private.data = NULL; - newdata->private.cleanup = NULL; + memset (&newdata->private, 0, sizeof (newdata->private)); newdata->usage_count = 0; newdata->use_translit = 0; newdata->nstrings = filedata->nstrings; @@ -282,10 +281,18 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) } void -_nl_unload_locale (struct __locale_data *locale) +_nl_unload_locale (int category, struct __locale_data *locale) { - if (locale->private.cleanup) - (*locale->private.cleanup) (locale); + /* Deallocate locale->private. */ + switch (category) + { + case LC_CTYPE: + _nl_cleanup_ctype (locale); + break; + case LC_TIME: + _nl_cleanup_time (locale); + break; + } switch (__builtin_expect (locale->alloc, ld_mapped)) { |