summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2011-11-14 19:30:17 +1100
committerTony Cook <tony@develop-help.com>2011-11-14 19:30:17 +1100
commit28884311ae0933070ec776bd972da9d711a5184b (patch)
tree52a185013e289ab75457e4ddd21974f0cd9cf88d /universal.c
parentaeba7c97cf81cc1734fe47cebfeef2fa5e3d696f (diff)
downloadperl-28884311ae0933070ec776bd972da9d711a5184b.tar.gz
[rt #103222] make Internals::SvREFCNT set/get consistent
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/universal.c b/universal.c
index d623a67ed3..0599e6795d 100644
--- a/universal.c
+++ b/universal.c
@@ -927,8 +927,8 @@ XS(XS_Internals_SvREFCNT) /* This is dangerous stuff. */
XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */
else if (items == 2) {
/* I hope you really know what you are doing. */
- SvREFCNT(sv) = SvIV(ST(1));
- XSRETURN_IV(SvREFCNT(sv));
+ SvREFCNT(sv) = SvIV(ST(1)) + 1; /* we free one ref on exit */
+ XSRETURN_IV(SvREFCNT(sv) - 1);
}
XSRETURN_UNDEF; /* Can't happen. */
}