From 72c743750c2a76df3611aa9a77ba72edefa2fb88 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 5 Jan 2000 07:47:25 +0000 Subject: Update. * locale/programs/stringtrans.c: Removed. * locale/programs/stringtrans.h: Removed. * locale/findlocale.c (_nl_find_locale): Don't try using mmap is _POSIX_MAPPED_FILES is not defined. * locale/findlocale.c (_nl_find_locale): Correct memory allocation for loc_name copy. * locale/setlocale.c (new_composite_name): Use _nl_C_name and _nl_POSIX_name instead of "C" and "POSIX" strings. --- locale/findlocale.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'locale/findlocale.c') diff --git a/locale/findlocale.c b/locale/findlocale.c index 9cb2206..979b90f 100644 --- a/locale/findlocale.c +++ b/locale/findlocale.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -21,7 +21,9 @@ #include #include #include -#include +#ifdef _POSIX_MAPPED_FILES +# include +#endif #include "localeinfo.h" @@ -86,7 +88,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, loc_name = (char *) *name; /* Make a writable copy of the locale name. */ - loc_name = __strdup (loc_name); + loc_name = strdupa (loc_name); /* LOCALE can consist of up to four recognized parts for the XPG syntax: @@ -135,11 +137,6 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, /* This means we are out of core. */ return NULL; } - else - /* If the addressed locale is already available it should be - freed. If we would not do this switching back and force - between two locales would slowly eat up all memory. */ - free ((void *) loc_name); /* The space for normalized_codeset is dynamically allocated. Free it. */ if (mask & XPG_NORM_CODESET) @@ -215,6 +212,7 @@ _nl_remove_locale (int locale, struct locale_data *data) /* Free the name. */ free ((char *) data->name); +#ifdef _POSIX_MAPPED_FILES /* Really delete the data. First delete the real data. */ if (data->mmaped) { @@ -227,6 +225,7 @@ _nl_remove_locale (int locale, struct locale_data *data) } } else +#endif /* _POSIX_MAPPED_FILES */ /* The memory was malloced. */ free ((void *) data->filedata); -- cgit v1.1