summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-26 18:12:32 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-26 18:12:32 +0000
commit43230e26bd52e1dcdb541bb4a927c941262b74ed (patch)
tree208c0810033bd66cd36c0a5902f52f146d6c02b1 /sv.c
parentdd48e7ab8eb6069673c480ccd5a1f28dca88269b (diff)
downloadperl-43230e26bd52e1dcdb541bb4a927c941262b74ed.tar.gz
Take code that occurs in three places to take a scalar and ready it to
hold a reference, and convert it to a macro define prepare_SV_for_RV(). p4raw-id: //depot/perl@32737
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index 7b49ce21e5..577c13415e 100644
--- a/sv.c
+++ b/sv.c
@@ -7857,12 +7857,8 @@ Perl_newSVrv(pTHX_ SV *rv, const char *classname)
sv_upgrade(rv, SVt_IV);
} else if (SvROK(rv)) {
SvREFCNT_dec(SvRV(rv));
- } else if (SvTYPE(rv) < SVt_PV && SvTYPE(rv) != SVt_IV)
- sv_upgrade(rv, SVt_IV);
- else if (SvTYPE(rv) >= SVt_PV) {
- SvPV_free(rv);
- SvCUR_set(rv, 0);
- SvLEN_set(rv, 0);
+ } else {
+ prepare_SV_for_RV(rv);
}
SvOK_off(rv);