From 8ef6e574dc20ae6630168de22486c9083ad307af Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Fri, 23 Aug 2013 13:38:03 -0600 Subject: [PATCH] PATCH: [perl #119443] Blead won't compile on wince This commit adds #if's to cause locale handling code to compile on platforms that don't have full-featured locale handling. The commits mentioned in the ticket did not adequately cover these situations. --- embed.fnc | 4 +--- embed.h | 4 +--- locale.c | 17 +++++++++++++---- proto.h | 4 +--- sv.c | 3 +++ 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/embed.fnc b/embed.fnc index e076893..5cd5daa 100644 --- a/embed.fnc +++ b/embed.fnc @@ -2280,12 +2280,10 @@ s |bool|isa_lookup |NN HV *stash|NN const char * const name \ |STRLEN len|U32 flags #endif -#if defined(PERL_IN_LOCALE_C) -#if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +#if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) s |char* |stdize_locale |NN char* locs s |bool |is_cur_LC_category_utf8|int category #endif -#endif #if defined(PERL_IN_UTIL_C) s |const COP*|closest_cop |NN const COP *cop|NULLOK const OP *o diff --git a/embed.h b/embed.h index d89782f..6cdcf82 100644 --- a/embed.h +++ b/embed.h @@ -1393,11 +1393,9 @@ #define share_hek_flags(a,b,c,d) S_share_hek_flags(aTHX_ a,b,c,d) #define unshare_hek_or_pvn(a,b,c,d) S_unshare_hek_or_pvn(aTHX_ a,b,c,d) # endif -# if defined(PERL_IN_LOCALE_C) -# if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +# if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) #define is_cur_LC_category_utf8(a) S_is_cur_LC_category_utf8(aTHX_ a) #define stdize_locale(a) S_stdize_locale(aTHX_ a) -# endif # endif # if defined(PERL_IN_MALLOC_C) #define adjust_size_and_find_bucket S_adjust_size_and_find_bucket diff --git a/locale.c b/locale.c index c16b363..7ec3463 100644 --- a/locale.c +++ b/locale.c @@ -34,6 +34,8 @@ #include "reentr.h" +#ifdef USE_LOCALE + /* * Standardize the locale name from a string returned by 'setlocale'. * @@ -76,6 +78,8 @@ S_stdize_locale(pTHX_ char *locs) return locs; } +#endif + void Perl_set_numeric_radix(pTHX) { @@ -507,9 +511,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn) } -#endif /* USE_LOCALE */ - -#ifdef USE_PERLIO +#if defined(USE_PERLIO) && defined(USE_LOCALE_CTYPE) { /* Set PL_utf8locale to TRUE if using PerlIO _and_ the current LC_CTYPE locale is UTF-8. @@ -539,6 +541,9 @@ Perl_init_i18nl10n(pTHX_ int printwarn) #ifdef USE_LOCALE_NUMERIC Safefree(curnum); #endif /* USE_LOCALE_NUMERIC */ + +#endif /* USE_LOCALE */ + return ok; } @@ -605,6 +610,8 @@ Perl_mem_collxfrm(pTHX_ const char *s, STRLEN len, STRLEN *xlen) #endif /* USE_LOCALE_COLLATE */ +#ifdef USE_LOCALE + STATIC bool S_is_cur_LC_category_utf8(pTHX_ int category) { @@ -616,7 +623,9 @@ S_is_cur_LC_category_utf8(pTHX_ int category) char *save_input_locale = NULL; STRLEN final_pos; +#ifdef LC_ALL assert(category != LC_ALL); +#endif /* First dispose of the trivial cases */ save_input_locale = stdize_locale(setlocale(category, NULL)); @@ -887,7 +896,7 @@ S_is_cur_LC_category_utf8(pTHX_ int category) return FALSE; } - +#endif /* * Local variables: diff --git a/proto.h b/proto.h index e027627..48723db 100644 --- a/proto.h +++ b/proto.h @@ -5797,15 +5797,13 @@ PERL_CALLCONV SV* Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp) assert(hv); assert(indexp) #endif -#if defined(PERL_IN_LOCALE_C) -# if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +#if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) STATIC bool S_is_cur_LC_category_utf8(pTHX_ int category); STATIC char* S_stdize_locale(pTHX_ char* locs) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_STDIZE_LOCALE \ assert(locs) -# endif #endif #if defined(PERL_IN_MALLOC_C) STATIC int S_adjust_size_and_find_bucket(size_t *nbytes_p) diff --git a/sv.c b/sv.c index 6b858de..b47697f 100644 --- a/sv.c +++ b/sv.c @@ -11358,11 +11358,14 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p } float_converted: eptr = PL_efloatbuf; + +#ifdef USE_LOCALE_NUMERIC if (PL_numeric_radix_sv && SvUTF8(PL_numeric_radix_sv) && instr(eptr, SvPVX_const(PL_numeric_radix_sv))) { is_utf8 = TRUE; } +#endif break; -- 2.7.4