summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embed.fnc1
-rw-r--r--embed.h1
-rw-r--r--proto.h3
-rw-r--r--regcomp.c14
4 files changed, 17 insertions, 2 deletions
diff --git a/embed.fnc b/embed.fnc
index 4bd9e11f18..a08ebdc4ee 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1532,6 +1532,7 @@ EiMn |void |invlist_set_previous_index|NN SV* const invlist|const IV index
EiMRn |IV |invlist_previous_index|NN SV* const invlist
EiMn |void |invlist_trim |NN SV* invlist
#endif
+EiM |void |invlist_clear |NN SV* invlist
EiMR |SV* |invlist_clone |NN SV* const invlist
EiMRn |STRLEN*|get_invlist_iter_addr |NN SV* invlist
EiMn |void |invlist_iterinit|NN SV* invlist
diff --git a/embed.h b/embed.h
index 5d3f719c31..ede352038b 100644
--- a/embed.h
+++ b/embed.h
@@ -1002,6 +1002,7 @@
#define handle_named_backref(a,b,c,d) S_handle_named_backref(aTHX_ a,b,c,d)
#define handle_possible_posix(a,b,c,d) S_handle_possible_posix(aTHX_ a,b,c,d)
#define handle_regex_sets(a,b,c,d,e) S_handle_regex_sets(aTHX_ a,b,c,d,e)
+#define invlist_clear(a) S_invlist_clear(aTHX_ a)
#define invlist_clone(a) S_invlist_clone(aTHX_ a)
#define invlist_contents(a,b) S_invlist_contents(aTHX_ a,b)
#define invlist_extend(a,b) S_invlist_extend(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index 2852f6ff1e..0762b5cd4a 100644
--- a/proto.h
+++ b/proto.h
@@ -4749,6 +4749,9 @@ STATIC int S_handle_possible_posix(pTHX_ RExC_state_t *pRExC_state, const char*
STATIC regnode* S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV ** return_invlist, I32 *flagp, U32 depth, char * const oregcomp_parse);
#define PERL_ARGS_ASSERT_HANDLE_REGEX_SETS \
assert(pRExC_state); assert(flagp); assert(oregcomp_parse)
+PERL_STATIC_INLINE void S_invlist_clear(pTHX_ SV* invlist);
+#define PERL_ARGS_ASSERT_INVLIST_CLEAR \
+ assert(invlist)
PERL_STATIC_INLINE SV* S_invlist_clone(pTHX_ SV* const invlist)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_INVLIST_CLONE \
diff --git a/regcomp.c b/regcomp.c
index b5d4932d90..beff554f4e 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -8442,6 +8442,17 @@ S_invlist_trim(SV* invlist)
}
}
+PERL_STATIC_INLINE void
+S_invlist_clear(pTHX_ SV* invlist) /* Empty the inversion list */
+{
+ PERL_ARGS_ASSERT_INVLIST_CLEAR;
+
+ assert(SvTYPE(invlist) == SVt_INVLIST);
+
+ invlist_set_len(invlist, 0, 0);
+ invlist_trim(invlist);
+}
+
#endif /* ifndef PERL_IN_XSUB_RE */
PERL_STATIC_INLINE bool
@@ -9357,8 +9368,7 @@ Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b,
invlist_replace_list_destroys_src(*i, r);
}
else {
- invlist_set_len(*i, 0, 0);
- invlist_trim(*i);
+ invlist_clear(*i);
}
SvREFCNT_dec_NN(r);
}