memmov() memory that's about to be freed. Seems wasteful.
p4raw-id: //depot/perl@24344
return;
}
if (SvPVX(dstr)) {
- (void)SvOOK_off(dstr); /* backoff */
- if (SvLEN(dstr))
- Safefree(SvPVX(dstr));
+ if (SvLEN(dstr)) {
+ /* Unwrap the OOK offset by hand, to save a needless
+ memmove on memory that's about to be free()d. */
+ char *pv = SvPVX(dstr);
+ if (SvOOK(dstr)) {
+ pv -= SvIVX(dstr);
+ SvFLAGS(dstr) &= ~SVf_OOK;
+ }
+ Safefree(pv);
+ }
SvLEN_set(dstr, 0);
SvCUR_set(dstr, 0);
}
case SVt_PVNV:
case SVt_PVIV:
freescalar:
- SvOOK_off(sv);
+ /* Don't bother with SvOOK_off(sv); as we're only going to free it. */
+ if (SvOOK(sv)) {
+ SvPV_set(sv, SvPVX(sv) - SvIVX(sv));
+ /* Don't even bother with turning off the OOK flag. */
+ }
/* FALL THROUGH */
case SVt_PV:
case SVt_RV: