about summary refs log tree commit diff
path: root/locale/newlocale.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-08 01:33:05 +0000
committerRoland McGrath <roland@gnu.org>2002-08-08 01:33:05 +0000
commit78323b5b80225fb88f783c8f74fc8ce86d0fbf23 (patch)
treec1838c8477dd8c474c50ca1680e28b9392944b51 /locale/newlocale.c
parent2a54ad77a156e9df608c7964a4a1ef042df6b9d4 (diff)
downloadglibc-78323b5b80225fb88f783c8f74fc8ce86d0fbf23.tar.gz
glibc-78323b5b80225fb88f783c8f74fc8ce86d0fbf23.tar.xz
glibc-78323b5b80225fb88f783c8f74fc8ce86d0fbf23.zip
* inet/getnetgrent_r.c (endnetgrent, __getnetgrent_r): Actually call
	the static symbols added in the last change (doofus is me).

	* locale/newlocale.c (__newlocale): Use a bit mask instead of a second
	loop to notice missing categories in a composite name.

	* locale/locale.h (LC_CTYPE_MASK, LC_NUMERIC_MASK, LC_TIME_MASK,
	LC_COLLATE_MASK, LC_MONETARY_MASK, LC_MESSAGES_MASK, LC_ALL_MASK,
	LC_PAPER_MASK, LC_NAME_MASK, LC_ADDRESS_MASK, LC_TELEPHONE_MASK,
	LC_MEASUREMENT_MASK, LC_IDENTIFICATION_MASK, LC_ALL_MASK): New macros.

	* malloc/tst-calloc.c: Add tests for one or both parameters being zero.
Diffstat (limited to 'locale/newlocale.c')
-rw-r--r--locale/newlocale.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/locale/newlocale.c b/locale/newlocale.c
index 1442f86e81..6bab98e219 100644
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -104,6 +104,7 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
       /* This is a composite name.  Make a copy and split it up.  */
       char *np = strdupa (locale);
       char *cp;
+      int specified_mask = 0;
 
       while ((cp = strchr (np, '=')) != NULL)
 	{
@@ -118,6 +119,7 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
 	    ERROR_RETURN;
 
 	  /* Found the category this clause sets.  */
+	  specified_mask |= 1 << cnt;
 	  newnames[cnt] = ++cp;
 	  cp = strchr (cp, ';');
 	  if (cp != NULL)
@@ -131,11 +133,9 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
 	    break;
 	}
 
-      for (cnt = 0; cnt < __LC_LAST; ++cnt)
-	if (cnt != LC_ALL
-	    && (category_mask & 1 << cnt) != 0 && newnames[cnt] == locale)
-	  /* The composite name did not specify the category we need.  */
-	  ERROR_RETURN;
+      if (category_mask &~ specified_mask)
+	/* The composite name did not specify all categories we need.  */
+	ERROR_RETURN;
     }
 
   /* Now process all categories we are interested in.  */