X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-localename.c;h=09f002c8c1360d9fff49079b8756ac78e37f91dc;hb=6045c2ba7c6a9fb040d41abd78765bfad437a08f;hp=38fc33040a07e2de90f8bf804db065bb664b9e33;hpb=52d1d6a50dbe687f788b93ccc4a754bbf6ee0d46;p=gnulib.git diff --git a/tests/test-localename.c b/tests/test-localename.c index 38fc33040..09f002c8c 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -1,5 +1,5 @@ /* Test of gl_locale_name function and its variants. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,9 @@ #include "macros.h" + +#if HAVE_NEWLOCALE + static struct { int cat; int mask; const char *string; } const categories[] = { { LC_CTYPE, LC_CTYPE_MASK, "LC_CTYPE" }, @@ -54,6 +57,8 @@ static struct { int cat; int mask; const char *string; } const categories[] = # endif }; +#endif + /* Test the gl_locale_name() function. */ static void test_locale_name (void) @@ -414,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; ) @@ -442,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. */