From: Bruno Haible Date: Thu, 31 Dec 2009 01:36:46 +0000 (+0100) Subject: Fix test crash. X-Git-Tag: v0.1~4960 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c7a120f0df82737c24832f6a0c6cc7e1bfd4e671;p=gnulib.git Fix test crash. --- diff --git a/ChangeLog b/ChangeLog index 7f09e847e..89ea5137a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-12-30 Bruno Haible + Fix test crash. + * tests/test-localename.c (test_locale_name_thread): Skip unavailable + locales. + Reported by Simon Josefsson . + +2009-12-30 Bruno Haible + Fix compilation error on most platforms. * tests/test-localename.c (categories): Define only if HAVE_NEWLOCALE. Reported by Simon Josefsson diff --git a/tests/test-localename.c b/tests/test-localename.c index 9afa93244..6fc158db1 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -419,12 +419,13 @@ test_locale_name_thread (void) } /* 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 @@ test_locale_name_thread (void) } /* 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. */