Skip to content

Commit 4d21c02

Browse files
committed
locale.c: Create a convenience #define
This takes this #ifdef combination and creates a single symbol that means essentially the same thing. This is in preparation for it being used in additional places. And it makes it clearer what is meant. It also adds another condition which isn't currently tested for, but has the same meaning, and doesn't affect the current usage, but will future ones.
1 parent 5351ec0 commit 4d21c02

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

locale.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ static int debug_initialization = 0;
156156
# include <wctype.h>
157157
#endif
158158

159+
/* If we have any of these library functions, we can reliably determine is a
160+
* locale is a UTF-8 one or not. And if we aren't using locales at all, we act
161+
* as if everything is the C locale, so the answer there is always "No, it
162+
* isn't UTF-8"; this too is reliably accurate */
163+
#if defined(HAS_SOME_LANGINFO) || defined(HAS_MBTOWC) || defined(HAS_MBRTOWC) \
164+
|| ! defined(USE_LOCALE)
165+
# define HAS_RELIABLE_UTF8NESS_DETERMINATION
166+
#endif
167+
159168
#ifdef USE_LOCALE
160169

161170
PERL_STATIC_INLINE const char *
@@ -2978,7 +2987,7 @@ S_get_locale_string_utf8ness_i(pTHX_ const char * locale,
29782987
}
29792988
}
29802989

2981-
# if defined(HAS_SOME_LANGINFO) || defined(HAS_MBTOWC) || defined(HAS_MBRTOWC)
2990+
# ifdef HAS_RELIABLE_UTF8NESS_DETERMINATION
29822991

29832992
/* Here, we have available the libc functions that can be used to
29842993
* accurately determine the UTF8ness of the underlying locale. If it is a

0 commit comments

Comments
 (0)