1515#include "posix.h"
1616#include "userdiff.h"
1717
18+ #if LC_ALL > 0
1819static const char * old_locales [LC_ALL ];
20+ #endif
1921
2022void test_core_posix__initialize (void )
2123{
24+ #if LC_ALL > 0
2225 memset (& old_locales , 0 , sizeof (old_locales ));
26+ #endif
2327
2428#ifdef GIT_WIN32
2529 /* on win32, the WSA context needs to be initialized
@@ -33,13 +37,6 @@ void test_core_posix__initialize(void)
3337
3438void test_core_posix__cleanup (void )
3539{
36- int i ;
37-
38- for (i = 0 ; i < LC_ALL ; i ++ ) {
39- if (old_locales [i ])
40- setlocale (i , old_locales [i ]);
41- }
42-
4340 p_unlink ("fallocate_test" );
4441}
4542
@@ -165,7 +162,9 @@ void test_core_posix__utimes(void)
165162
166163static void try_set_locale (int category )
167164{
165+ #if LC_ALL > 0
168166 old_locales [category ] = setlocale (category , NULL );
167+ #endif
169168
170169 if (!setlocale (category , "UTF-8" ) &&
171170 !setlocale (category , "c.utf8" ) &&
@@ -191,6 +190,10 @@ void test_core_posix__p_regcomp_ignores_global_locale_collate(void)
191190{
192191 p_regex_t preg ;
193192
193+ #ifdef GIT_WIN32
194+ cl_skip ();
195+ #endif
196+
194197 try_set_locale (LC_COLLATE );
195198 cl_assert (!p_regcomp (& preg , "[\xc0-\xff][\x80-\xbf]" , P_REG_EXTENDED ));
196199
@@ -202,6 +205,10 @@ void test_core_posix__p_regcomp_matches_digits_with_locale(void)
202205 p_regex_t preg ;
203206 char c , str [2 ];
204207
208+ #ifdef GIT_WIN32
209+ cl_skip ();
210+ #endif
211+
205212 try_set_locale (LC_COLLATE );
206213 try_set_locale (LC_CTYPE );
207214
@@ -221,6 +228,10 @@ void test_core_posix__p_regcomp_matches_alphabet_with_locale(void)
221228 p_regex_t preg ;
222229 char c , str [2 ];
223230
231+ #ifdef GIT_WIN32
232+ cl_skip ();
233+ #endif
234+
224235 try_set_locale (LC_COLLATE );
225236 try_set_locale (LC_CTYPE );
226237
0 commit comments