summary refs log tree commit diff
path: root/locale/findlocale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-05 07:47:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-05 07:47:25 +0000
commit72c743750c2a76df3611aa9a77ba72edefa2fb88 (patch)
tree7c3d82137a6a8ef9a830341c8fff007133fa9bd0 /locale/findlocale.c
parentf4aa71f4250923db875eb7df2d990020e1f5e2a3 (diff)
downloadglibc-72c743750c2a76df3611aa9a77ba72edefa2fb88.tar.gz
glibc-72c743750c2a76df3611aa9a77ba72edefa2fb88.tar.xz
glibc-72c743750c2a76df3611aa9a77ba72edefa2fb88.zip
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.
Diffstat (limited to 'locale/findlocale.c')
-rw-r--r--locale/findlocale.c15
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);