about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/C_name.c7
-rw-r--r--locale/Makefile2
-rw-r--r--locale/setlocale.c9
3 files changed, 11 insertions, 7 deletions
diff --git a/locale/C_name.c b/locale/C_name.c
new file mode 100644
index 0000000000..5e7cb85a09
--- /dev/null
+++ b/locale/C_name.c
@@ -0,0 +1,7 @@
+/* Define a constant for the name of the standard C locale, so the string
+   constant is not repeated in dozens of object files.  */
+
+#include "localeinfo.h"
+
+/* Name of our standard locale.  */
+const char _nl_C_name[] = "C";
diff --git a/locale/Makefile b/locale/Makefile
index 6b208b71a6..d7941d689f 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -30,7 +30,7 @@ distribute	= localeinfo.h categories.def \
 		  locales.h locfile.h stringtrans.h
 routines	= setlocale findlocale loadlocale localeconv nl_langinfo
 categories	= ctype messages monetary numeric time collate
-aux		= $(categories:%=lc-%) $(categories:%=C-%) SYS_libc
+aux		= $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name
 others		= localedef locale
 install-bin	= localedef locale
 extra-objs	= $(localedef-modules:=.o) $(locale-modules:=.o) \
diff --git a/locale/setlocale.c b/locale/setlocale.c
index c0d6fcdc4e..6eb6d98d70 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -102,9 +102,6 @@ void (*const _nl_category_postload[]) (void) =
   };
 
 
-/* Name of our standard locale.  */
-const char _nl_C_name[] = "C";
-
 /* Name of current locale for each individual category.
    Each is malloc'd unless it is nl_C_name.  */
 static const char *_nl_current_names[] =
@@ -261,7 +258,7 @@ setlocale (int category, const char *locale)
   if (__argz_append (&locale_path, &locale_path_len,
 		     LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
     return NULL;
-  
+
   if (category == LC_ALL)
     {
       /* The user wants to set all categories.  The desired locales
@@ -274,7 +271,7 @@ setlocale (int category, const char *locale)
       /* Set all name pointers to the argument name.  */
       for (category = 0; category < LC_ALL; ++category)
 	newnames[category] = (char *) locale;
-      
+
       if (strchr (locale, ';') != NULL)
 	{
 	  /* This is a composite name.  Make a copy and split it up.  */
@@ -329,7 +326,7 @@ setlocale (int category, const char *locale)
 		int save_errno;
 	      abort_composite:
 		save_errno = errno;
-		
+
 		while (++category < LC_ALL)
 		  if (_nl_current[category] != NULL)
 		    _nl_free_locale (newdata[category]);