changeset 12527:bf645800d5b3

Fix test crash.
author Bruno Haible <bruno@clisp.org>
date Thu, 31 Dec 2009 02:36:46 +0100
parents 01da2b836972
children a734da16f5c4
files ChangeLog tests/test-localename.c
diffstat 2 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-30  Bruno Haible  <bruno@clisp.org>
+
+	Fix test crash.
+	* tests/test-localename.c (test_locale_name_thread): Skip unavailable
+	locales.
+	Reported by Simon Josefsson <simon@josefsson.org>.
+
 2009-12-30  Bruno Haible  <bruno@clisp.org>
 
 	Fix compilation error on most platforms.
--- a/tests/test-localename.c
+++ b/tests/test-localename.c
@@ -419,12 +419,13 @@
       }
     /* Verify the unsaved_names are still valid.  */
     for (j = 0; j < SIZEOF (choices); j++)
-      {
-        unsigned int i;
+      if (available[j])
+        {
+          unsigned int i;
 
-        for (i = 0; i < SIZEOF (categories); i++)
-          ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
-      }
+          for (i = 0; i < SIZEOF (categories); i++)
+            ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+        }
     /* Allocate many locales, without freeing them.  This is an attempt at
        overwriting as much of the previously allocated memory as possible.  */
     for (j = SIZEOF (choices); j > 0; )
@@ -447,12 +448,13 @@
       }
     /* Verify the unsaved_names are still valid.  */
     for (j = 0; j < SIZEOF (choices); j++)
-      {
-        unsigned int i;
+      if (available[j])
+        {
+          unsigned int i;
 
-        for (i = 0; i < SIZEOF (categories); i++)
-          ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
-      }
+          for (i = 0; i < SIZEOF (categories); i++)
+            ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+        }
   }
 #else
   /* Check that gl_locale_name_thread always returns NULL.  */