diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-10-15 17:11:08 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-10-15 17:11:08 +0000 |
commit | 5fcdf167f4386a3583bf0db9d98b989639295a45 (patch) | |
tree | 196d537a9c2aae33aea4f0c2500053b34fc83295 /sv.c | |
parent | 2cbb2ee1d6d1dc9f375107de4b70573ece8a4e13 (diff) | |
download | perl-5fcdf167f4386a3583bf0db9d98b989639295a45.tar.gz |
Implement sv_svset _nosteal variants by passing a flag into
sv_set_flags rather than messing with the SvTEMP() flag on either
side of the call.
p4raw-id: //depot/perl@23373
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4130,8 +4130,9 @@ function if the source SV needs to be reused. Does not handle 'set' magic. Loosely speaking, it performs a copy-by-value, obliterating any previous content of the destination. If the C<flags> parameter has the C<SV_GMAGIC> bit set, will C<mg_get> on -C<ssv> if appropriate, else not. C<sv_setsv> and C<sv_setsv_nomg> are -implemented in terms of this function. +C<ssv> if appropriate, else not. If the C<flags> parameter has the +C<NOSTEAL> bit set then the buffers of temps will not be stolen. <sv_setsv> +and C<sv_setsv_nomg> are implemented in terms of this function. You probably want to use one of the assortment of wrappers, such as C<SvSetSV>, C<SvSetSV_nosteal>, C<SvSetMagicSV> and @@ -4515,6 +4516,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) !(isSwipe = (sflags & SVs_TEMP) && /* slated for free anyway? */ !(sflags & SVf_OOK) && /* and not involved in OOK hack? */ + (!(flags & SV_NOSTEAL)) && + /* and we're allowed to steal temps */ SvREFCNT(sstr) == 1 && /* and no other references to it? */ SvLEN(sstr) && /* and really is a string */ /* and won't be needed again, potentially */ |