summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-08-15 15:22:03 -0600
committerKarl Williamson <khw@cpan.org>2018-08-20 12:44:25 -0600
commit3d74616334d940df3e648ff7f770055ccdc8ef4e (patch)
treeba163a16e3b992d08f46270c053ff369ac4dd5b1
parent0fc466a3aa56ce982618130d8081815999d72a50 (diff)
downloadperl-3d74616334d940df3e648ff7f770055ccdc8ef4e.tar.gz
Make sv_setsv_flags accept an inversion list src
Inversion lists are a type of SV, but aren't really convertible to other types, nor has there been a need to. But it makes things more convenient for a future commit to allow one to just clobber whatever is in an SV and replace it with an inversion list. Even after this commit, there are restrictions to what the SV can have that gets clobbered. But this is a step towards more generality
-rw-r--r--embed.fnc2
-rw-r--r--embed.h4
-rw-r--r--proto.h8
-rw-r--r--sv.c5
4 files changed, 13 insertions, 6 deletions
diff --git a/embed.fnc b/embed.fnc
index bcb9fddc29..5164a99ede 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1740,7 +1740,7 @@ EXMpR |SV* |_add_range_to_invlist |NULLOK SV* invlist|UV start|UV end
EXMpR |SV* |_setup_canned_invlist|const STRLEN size|const UV element0|NN UV** other_elements_ptr
EXMpn |void |_invlist_populate_swatch |NN SV* const invlist|const UV start|const UV end|NN U8* swatch
#endif
-#if defined(PERL_IN_REGCOMP_C)
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_SV_C)
EMpX |SV* |invlist_clone |NN SV* const invlist|NULLOK SV* newlist
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C)
diff --git a/embed.h b/embed.h
index 40930d9c06..a990f3917a 100644
--- a/embed.h
+++ b/embed.h
@@ -1189,7 +1189,6 @@
#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,b) Perl_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
@@ -1263,6 +1262,9 @@
# if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C)
#define _core_swash_init(a,b,c,d,e,f,g) Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g)
# endif
+# if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_SV_C)
+#define invlist_clone(a,b) Perl_invlist_clone(aTHX_ a,b)
+# endif
# if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_DQUOTE_C)
#define form_short_octal_warning(a,b) S_form_short_octal_warning(aTHX_ a,b)
#define grok_bslash_c(a,b) Perl_grok_bslash_c(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index dd6c789dda..82349124c4 100644
--- a/proto.h
+++ b/proto.h
@@ -5434,9 +5434,6 @@ 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_CALLCONV SV* Perl_invlist_clone(pTHX_ SV* const invlist, SV* newlist);
-#define PERL_ARGS_ASSERT_INVLIST_CLONE \
- assert(invlist)
STATIC SV* S_invlist_contents(pTHX_ SV* const invlist, const bool traditional_style)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_INVLIST_CONTENTS \
@@ -5695,6 +5692,11 @@ PERL_CALLCONV SV* Perl__core_swash_init(pTHX_ const char* pkg, const char* name,
#define PERL_ARGS_ASSERT__CORE_SWASH_INIT \
assert(pkg); assert(name); assert(listsv)
#endif
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_SV_C)
+PERL_CALLCONV SV* Perl_invlist_clone(pTHX_ SV* const invlist, SV* newlist);
+#define PERL_ARGS_ASSERT_INVLIST_CLONE \
+ assert(invlist)
+#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_DQUOTE_C)
#ifndef PERL_NO_INLINE_FUNCTIONS
PERL_STATIC_INLINE char* S_form_short_octal_warning(pTHX_ const char * const s, const STRLEN len)
diff --git a/sv.c b/sv.c
index e0b7feb2f9..77f63183f7 100644
--- a/sv.c
+++ b/sv.c
@@ -4332,6 +4332,10 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* sstr, const I32 flags)
if (dtype < SVt_PVNV)
sv_upgrade(dstr, SVt_PVNV);
break;
+
+ case SVt_INVLIST:
+ invlist_clone(sstr, dstr);
+ break;
default:
{
const char * const type = sv_reftype(sstr,0);
@@ -4349,7 +4353,6 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* sstr, const I32 flags)
sv_upgrade(dstr, SVt_REGEXP);
break;
- case SVt_INVLIST:
case SVt_PVLV:
case SVt_PVGV:
case SVt_PVMG: