summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-02-12 20:53:20 -0700
committerKarl Williamson <khw@cpan.org>2020-02-19 22:09:48 -0700
commit60d8e2bf61eb07095157b2e3164e614e0b0dc4b3 (patch)
tree1db5fad996de9284f93de3c3bd3bb0dd158f1f8d
parentf0ac8a377ab01ad6936776b0c73d0c1eab98f782 (diff)
downloadperl-60d8e2bf61eb07095157b2e3164e614e0b0dc4b3.tar.gz
regcomp.c: Create wrapper fcn for re_op_compile
This does the bulk of re_compile(), but is a private entry point, meaning it takes an extra parameter, and a future commit will call it from another place.
-rw-r--r--embed.fnc1
-rw-r--r--embed.h1
-rw-r--r--proto.h5
-rw-r--r--regcomp.c13
4 files changed, 18 insertions, 2 deletions
diff --git a/embed.fnc b/embed.fnc
index 51c15e8560..0cb88ab95a 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1913,6 +1913,7 @@ EiRT |bool |invlist_iternext|NN SV* invlist|NN UV* start|NN UV* end
EiT |void |invlist_iterfinish|NN SV* invlist
#endif
#if defined(PERL_IN_REGCOMP_C)
+ERS |REGEXP*|re_op_compile_wrapper|NN SV * const pattern|U32 orig_rx_flags|const U32 pm_flags
EiRT |bool |invlist_is_iterating|NN SV* const invlist
EiR |SV* |invlist_contents|NN SV* const invlist \
|const bool traditional_style
diff --git a/embed.h b/embed.h
index 8152b16555..a6cd2b22d2 100644
--- a/embed.h
+++ b/embed.h
@@ -1045,6 +1045,7 @@
#define parse_lparen_question_flags(a) S_parse_lparen_question_flags(aTHX_ a)
#define parse_uniprop_string(a,b,c,d,e,f,g,h,i) Perl_parse_uniprop_string(aTHX_ a,b,c,d,e,f,g,h,i)
#define populate_ANYOF_from_invlist(a,b) S_populate_ANYOF_from_invlist(aTHX_ a,b)
+#define re_op_compile_wrapper(a,b,c) S_re_op_compile_wrapper(aTHX_ a,b,c)
#define reg(a,b,c,d) S_reg(aTHX_ a,b,c,d)
#define reg2Lanode(a,b,c,d) S_reg2Lanode(aTHX_ a,b,c,d)
#define reg_node(a,b) S_reg_node(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index de52524d01..cb314c28fb 100644
--- a/proto.h
+++ b/proto.h
@@ -5683,6 +5683,11 @@ PERL_STATIC_NO_RET void S_re_croak2(pTHX_ bool utf8, const char* pat1, const cha
#define PERL_ARGS_ASSERT_RE_CROAK2 \
assert(pat1); assert(pat2)
+STATIC REGEXP* S_re_op_compile_wrapper(pTHX_ SV * const pattern, U32 orig_rx_flags, const U32 pm_flags)
+ __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_RE_OP_COMPILE_WRAPPER \
+ assert(pattern)
+
STATIC regnode_offset S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth);
#define PERL_ARGS_ASSERT_REG \
assert(pRExC_state); assert(flagp)
diff --git a/regcomp.c b/regcomp.c
index caed27a719..fa23d38d8c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6626,15 +6626,24 @@ Perl_pregcomp(pTHX_ SV * const pattern, const U32 flags)
REGEXP *
Perl_re_compile(pTHX_ SV * const pattern, U32 rx_flags)
{
- SV *pat = pattern; /* defeat constness! */
PERL_ARGS_ASSERT_RE_COMPILE;
+ return re_op_compile_wrapper(pattern, rx_flags, 0);
+}
+
+REGEXP *
+S_re_op_compile_wrapper(pTHX_ SV * const pattern, U32 rx_flags, const U32 pm_flags)
+{
+ SV *pat = pattern; /* defeat constness! */
+
+ PERL_ARGS_ASSERT_RE_OP_COMPILE_WRAPPER;
+
return Perl_re_op_compile(aTHX_ &pat, 1, NULL,
#ifdef PERL_IN_XSUB_RE
&my_reg_engine,
#else
&PL_core_reg_engine,
#endif
- NULL, NULL, rx_flags, 0);
+ NULL, NULL, rx_flags, pm_flags);
}