diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-08-22 21:37:43 +0100 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2021-08-25 19:57:49 +0100 |
commit | ecc6bf9b4b2a775770929c210e3aa9213dfb5d93 (patch) | |
tree | d2ecefb0935561c78a6b51c07dc1fa9d406ea826 /sv.c | |
parent | 11d028376675b37f3e9c5f15bc93ab00562a25d1 (diff) | |
download | perl-ecc6bf9b4b2a775770929c210e3aa9213dfb5d93.tar.gz |
Add _mg() versions of the sv_setrv* family
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -1789,11 +1789,15 @@ Perl_sv_setnv_mg(pTHX_ SV *const sv, const NV num) /* =for apidoc sv_setrv_noinc +=for apidoc_item sv_setrv_noinc_mg Copies an SV pointer into the given SV as an SV reference, upgrading it if necessary. After this, C<SvRV(sv)> is equal to I<ref>. This does not adjust the reference count of I<ref>. The reference I<ref> must not be NULL. +C<sv_setrv_noinc_mg> will invoke 'set' magic on the SV; C<sv_setrv_noinc> will +not. + =cut */ @@ -1810,11 +1814,24 @@ Perl_sv_setrv_noinc(pTHX_ SV *const sv, SV *const ref) SvROK_on(sv); } +void +Perl_sv_setrv_noinc_mg(pTHX_ SV *const sv, SV *const ref) +{ + PERL_ARGS_ASSERT_SV_SETRV_NOINC_MG; + + sv_setrv_noinc(sv, ref); + SvSETMAGIC(sv); +} + /* =for apidoc sv_setrv_inc +=for apidoc_item sv_setrv_inc_mg As C<sv_setrv_noinc> but increments the reference count of I<ref>. +C<sv_setrv_inc_mg> will invoke 'set' magic on the SV; C<sv_setrv_inc> will +not. + =cut */ @@ -1826,6 +1843,15 @@ Perl_sv_setrv_inc(pTHX_ SV *const sv, SV *const ref) sv_setrv_noinc(sv, SvREFCNT_inc_simple_NN(ref)); } +void +Perl_sv_setrv_inc_mg(pTHX_ SV *const sv, SV *const ref) +{ + PERL_ARGS_ASSERT_SV_SETRV_INC_MG; + + sv_setrv_noinc(sv, SvREFCNT_inc_simple_NN(ref)); + SvSETMAGIC(sv); +} + /* Return a cleaned-up, printable version of sv, for non-numeric, or * not incrementable warning display. * Originally part of S_not_a_number(). |