summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-04-28 11:22:15 +0000
committerNicholas Clark <nick@ccl4.org>2005-04-28 11:22:15 +0000
commit8bd4d4c5ee440ccae167e2a7f5bf6f74ff02916b (patch)
treea0c18027ed2df90e52cd3274c69bcff795b71d6f /pp.c
parent9dcb96024af7087d05f03617e991e04fef9ff716 (diff)
downloadperl-8bd4d4c5ee440ccae167e2a7f5bf6f74ff02916b.tar.gz
Add a new macro SvPV_free() which undoes OOK and free()s the PVX(),
becase there's a lot of code around that calls SvOOK_off(), memmov()s the buffer, then promptly free()s it. So avoid the needless memmov(). p4raw-id: //depot/perl@24348
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index ca4f61d4cb..4500c575de 100644
--- a/pp.c
+++ b/pp.c
@@ -175,9 +175,7 @@ PP(pp_rv2gv)
if (SvTYPE(sv) < SVt_RV)
sv_upgrade(sv, SVt_RV);
if (SvPVX(sv)) {
- SvOOK_off(sv); /* backoff */
- if (SvLEN(sv))
- Safefree(SvPVX(sv));
+ SvPV_free(sv);
SvLEN_set(sv, 0);
SvCUR_set(sv, 0);
}
@@ -825,8 +823,7 @@ PP(pp_undef)
break;
default:
if (SvTYPE(sv) >= SVt_PV && SvPVX(sv) && SvLEN(sv)) {
- SvOOK_off(sv);
- Safefree(SvPVX(sv));
+ SvPV_free(sv);
SvPV_set(sv, Nullch);
SvLEN_set(sv, 0);
}