From f84ad0b1e075759d6926c05aeaba258e426774d1 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 28 Jan 1999 14:14:08 +0000 Subject: 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". --- locale/setlocale.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'locale/setlocale.c') diff --git a/locale/setlocale.c b/locale/setlocale.c index cde5b6a4fc..0f685bc355 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); -- cgit 1.4.1