#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,e) S_handle_possible_posix(aTHX_ a,b,c,d,e)
#define handle_regex_sets(a,b,c,d,e) S_handle_regex_sets(aTHX_ a,b,c,d,e)
-#define invlist_clone(a) S_invlist_clone(aTHX_ a)
+#define invlist_clone(a,b) S_invlist_clone(aTHX_ a,b)
#define invlist_contents(a,b) S_invlist_contents(aTHX_ a,b)
#define invlist_highest S_invlist_highest
#define invlist_is_iterating S_invlist_is_iterating
assert(RExC_rxi->data->what[n] == 's');
if (ary[1] && ary[1] != &PL_sv_undef) { /* Has compile-time swash */
- invlist = sv_2mortal(invlist_clone(_get_swash_invlist(ary[1])));
+ invlist = sv_2mortal(invlist_clone(_get_swash_invlist(ary[1]), NULL));
}
else if (ary[0] && ary[0] != &PL_sv_undef) {
/* Here no compile-time swash, and no run-time only data. Use the
* node's inversion list */
- invlist = sv_2mortal(invlist_clone(ary[3]));
+ invlist = sv_2mortal(invlist_clone(ary[3], NULL));
}
/* Get the code points valid only under UTF-8 locales */
* ANYOF node, with the first NUM_ANYOF_CODE_POINTS code points in a bit
* map */
- SV* invlist = invlist_clone(ssc->invlist);
+ SV* invlist = invlist_clone(ssc->invlist, NULL);
PERL_ARGS_ASSERT_SSC_FINALIZE;
invert = 1;
/* FALLTHROUGH */
case ASCII:
- my_invlist = invlist_clone(PL_Posix_ptrs[_CC_ASCII]);
+ my_invlist = invlist_clone(PL_Posix_ptrs[_CC_ASCII], NULL);
/* This can be handled as a Posix class */
goto join_posix_and_ascii;
/* FALLTHROUGH */
case POSIXA:
assert(FLAGS(scan) != _CC_ASCII);
- my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)]);
+ my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)], NULL);
goto join_posix_and_ascii;
case NPOSIXD:
/* FALLTHROUGH */
case POSIXD:
case POSIXU:
- my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)]);
+ my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)], NULL);
/* NPOSIXD matches all upper Latin1 code points unless the
* target string being matched is UTF-8, which is
* union. We can just return a copy of 'a' if '*output' doesn't point
* to an existing list */
if (*output == NULL) {
- *output = invlist_clone(a);
+ *output = invlist_clone(a, NULL);
return;
}
}
/* Here, '*output' is to be overwritten by 'a' */
- u = invlist_clone(a);
+ u = invlist_clone(a, NULL);
invlist_replace_list_destroys_src(*output, u);
SvREFCNT_dec_NN(u);
* the clone */
SV ** dest = (*output == NULL) ? output : &u;
- *dest = invlist_clone(b);
+ *dest = invlist_clone(b, NULL);
if (complement_b) {
_invlist_invert(*dest);
}
}
if (*i == NULL) {
- *i = invlist_clone(a);
+ *i = invlist_clone(a, NULL);
return;
}
- r = invlist_clone(a);
+ r = invlist_clone(a, NULL);
invlist_replace_list_destroys_src(*i, r);
SvREFCNT_dec_NN(r);
return;
#endif
PERL_STATIC_INLINE SV*
-S_invlist_clone(pTHX_ SV* const invlist)
+S_invlist_clone(pTHX_ SV* const invlist, SV* new_invlist)
{
/* Return a new inversion list that is a copy of the input one, which is
/* Need to allocate extra space to accommodate Perl's addition of a
* trailing NUL to SvPV's, since it thinks they are always strings */
- SV* new_invlist = _new_invlist(_invlist_len(invlist) + 1);
STRLEN physical_length = SvCUR(invlist);
bool offset = *(get_invlist_offset_addr(invlist));
PERL_ARGS_ASSERT_INVLIST_CLONE;
+ assert(new_invlist == NULL);
+
+ new_invlist = _new_invlist(_invlist_len(invlist) + 1);
*(get_invlist_offset_addr(new_invlist)) = offset;
invlist_set_len(new_invlist, _invlist_len(invlist), offset);
Copy(SvPVX(invlist), SvPVX(new_invlist), physical_length, char);
*
* Handle the case where there something like \W separately */
if (nposixes) {
- SV* only_non_utf8_list = invlist_clone(PL_UpperLatin1);
+ SV* only_non_utf8_list = invlist_clone(PL_UpperLatin1, NULL);
/* A complemented posix class matches all upper Latin1
* characters if not in UTF-8. And it matches just certain
));
}
else if (! *output_invlist) {
- *output_invlist = invlist_clone(invlist);
+ *output_invlist = invlist_clone(invlist, NULL);
}
else {
_invlist_union(*output_invlist, invlist, output_invlist);
* don't change the caller's list) */
if (nonbitmap_invlist) {
assert(invlist_highest(nonbitmap_invlist) < NUM_ANYOF_CODE_POINTS);
- invlist = invlist_clone(nonbitmap_invlist);
+ invlist = invlist_clone(nonbitmap_invlist, NULL);
}
else { /* Worst case size is every other code point is matched */
invlist = _new_invlist(NUM_ANYOF_CODE_POINTS / 2);
/* And this flag for matching all non-ASCII 0xFF and below */
if (flags & ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER)
{
- not_utf8 = invlist_clone(PL_UpperLatin1);
+ not_utf8 = invlist_clone(PL_UpperLatin1, NULL);
}
}
else if (OP(node) == ANYOFL) {
/* Since this list is passed in, we have to make a copy before
* modifying it */
- only_utf8_locale = invlist_clone(only_utf8_locale_invlist);
+ only_utf8_locale = invlist_clone(only_utf8_locale_invlist, NULL);
_invlist_subtract(only_utf8_locale, invlist, &only_utf8_locale);