From 94b0cb42d04bb202dba31ef85db6c93b0c93ae6d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 11 Sep 2019 17:08:25 -0600 Subject: Fix up get_regex_charset_name() This inline function should not be visible outside certain core (and ext/re) functions. Make that happen. --- embed.fnc | 3 +++ embed.h | 3 +++ inline.h | 8 +++++++- proto.h | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/embed.fnc b/embed.fnc index a8e9debb20..70e3411485 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1942,6 +1942,9 @@ EiRT |UV |_invlist_len |NN SV* const invlist EiRT |bool |_invlist_contains_cp|NN SV* const invlist|const UV cp EXpRT |SSize_t|_invlist_search |NN SV* const invlist|const UV cp #endif +#if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C) +EiT |const char *|get_regex_charset_name|const U32 flags|NN STRLEN* const lenp +#endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) EXp |SV* |_get_regclass_nonbitmap_data \ |NULLOK const regexp *prog \ diff --git a/embed.h b/embed.h index 2239115e2a..c1c3e85339 100644 --- a/embed.h +++ b/embed.h @@ -1182,6 +1182,9 @@ #define isSCRIPT_RUN(a,b,c) Perl_isSCRIPT_RUN(aTHX_ a,b,c) #define variant_under_utf8_count S_variant_under_utf8_count # endif +# if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C) +#define get_regex_charset_name S_get_regex_charset_name +# endif # if defined(PERL_IN_REGCOMP_C) #define _make_exactf_invlist(a,b) S__make_exactf_invlist(aTHX_ a,b) #define add_above_Latin1_folds(a,b,c) S_add_above_Latin1_folds(aTHX_ a,b,c) diff --git a/inline.h b/inline.h index 9d44bd4c95..f31ce6a8c9 100644 --- a/inline.h +++ b/inline.h @@ -1983,11 +1983,15 @@ S_lossless_NV_to_IV(const NV nv, IV *ivp) /* ------------------ pp.c, regcomp.c, toke.c, universal.c ------------ */ +#if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C) + #define MAX_CHARSET_NAME_LENGTH 2 PERL_STATIC_INLINE const char * -get_regex_charset_name(const U32 flags, STRLEN* const lenp) +S_get_regex_charset_name(const U32 flags, STRLEN* const lenp) { + PERL_ARGS_ASSERT_GET_REGEX_CHARSET_NAME; + /* Returns a string that corresponds to the name of the regex character set * given by 'flags', and *lenp is set the length of that string, which * cannot exceed MAX_CHARSET_NAME_LENGTH characters */ @@ -2008,6 +2012,8 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp) return "?"; /* Unknown */ } +#endif + /* Return false if any get magic is on the SV other than taint magic. diff --git a/proto.h b/proto.h index f7e1028af1..ee3a528a89 100644 --- a/proto.h +++ b/proto.h @@ -5798,6 +5798,13 @@ PERL_CALLCONV GV* Perl_softref2xv(pTHX_ SV *const sv, const char *const what, co #define PERL_ARGS_ASSERT_SOFTREF2XV \ assert(sv); assert(what); assert(spp) +#endif +#if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C) +#ifndef PERL_NO_INLINE_FUNCTIONS +PERL_STATIC_INLINE const char * S_get_regex_charset_name(const U32 flags, STRLEN* const lenp); +#define PERL_ARGS_ASSERT_GET_REGEX_CHARSET_NAME \ + assert(lenp) +#endif #endif #if defined(PERL_IN_PP_CTL_C) STATIC PerlIO * S_check_type_and_open(pTHX_ SV *name) -- cgit v1.2.1