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
!(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 */
#define SV_GMAGIC 2
#define SV_COW_DROP_PV 4
#define SV_UTF8_NO_ENCODING 8
+#define SV_NOSTEAL 16
/* We are about to replace the SV's current value. So if it's copy on write
we need to normalise it. Use the SV_COW_DROP_PV flag hint to say that
#define SvSetSV_nosteal_and(dst,src,finally) \
STMT_START { \
if ((dst) != (src)) { \
- U32 tMpF = SvFLAGS(src) & SVs_TEMP; \
- SvTEMP_off(src); \
- sv_setsv(dst, src); \
- SvFLAGS(src) |= tMpF; \
+ sv_setsv_flags(dst, src, SV_GMAGIC | SV_NOSTEAL); \
finally; \
} \
} STMT_END