aboutsummaryrefslogtreecommitdiff
path: root/locale/setlocale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-28 14:14:08 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-28 14:14:08 +0000
commitf84ad0b1e075759d6926c05aeaba258e426774d1 (patch)
tree3c5f697b7beca005e536c9b3d4a3829274bf1946 /locale/setlocale.c
parentd328b80b4e2620e0f34271a069b09c05ac16831d (diff)
downloadglibc-f84ad0b1e075759d6926c05aeaba258e426774d1.zip
glibc-f84ad0b1e075759d6926c05aeaba258e426774d1.tar.gz
glibc-f84ad0b1e075759d6926c05aeaba258e426774d1.tar.bz2
Update.
* intl/finddomain.c (free_mem): Also free filename. * locale/findlocale.c (free_mem): Likewise. (_nl_find_locale): Duplicate loc_name with strdupa not strdup. * locale/setlocale.c (free_mem): New function. Free current locale data and set current locale to "C".
Diffstat (limited to 'locale/setlocale.c')
-rw-r--r--locale/setlocale.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/locale/setlocale.c b/locale/setlocale.c
index cde5b6a..0f685bc 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 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
@@ -391,3 +391,25 @@ setlocale (int category, const char *locale)
return (char *) newname[0];
}
}
+
+
+static void __attribute__ ((unused))
+free_mem (void)
+{
+ int category;
+
+ for (category = 0; category < LC_ALL; ++category)
+ {
+ struct locale_data *here = *_nl_current[category];
+
+ /* We have to be prepared that sometime later me still might
+ need the locale information. */
+ *_nl_current[category] = _nl_C[category];
+ setname (category, _nl_C_name);
+
+ _nl_unload_locale (here);
+ }
+
+ setname (LC_ALL, _nl_C_name);
+}
+text_set_element (__libc_subfreeres, free_mem);