diff options
Diffstat (limited to 'locale/findlocale.c')
-rw-r--r-- | locale/findlocale.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c index 9cb22068f7..979b90fe88 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 <drepper@cygnus.com>, 1996. @@ -21,7 +21,9 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/mman.h> +#ifdef _POSIX_MAPPED_FILES +# include <sys/mman.h> +#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); |