summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-03-01 06:52:26 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-03-01 06:52:26 +0000
commitfbbbcc485c1d03c76a91f998e1e4492c8ad56b38 (patch)
tree3b1a893d2288b11451c4d4419edd75f4f85d2481 /sv.c
parentc69f6586a27b86846a13e0177336730d72b33c95 (diff)
parent1c1c7f20b839aeb1c04942d0884c3efb087d3e4a (diff)
downloadperl-fbbbcc485c1d03c76a91f998e1e4492c8ad56b38.tar.gz
[asperl] integrate mainline changes
p4raw-id: //depot/asperl@607
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index a31f41dcb1..ea6f6c4dbe 100644
--- a/sv.c
+++ b/sv.c
@@ -2295,7 +2295,7 @@ sv_usepvn(register SV *sv, register char *ptr, register STRLEN len)
void
sv_usepvn_mg(register SV *sv, register char *ptr, register STRLEN len)
{
- sv_usepvn_mg(sv,ptr,len);
+ sv_usepvn(sv,ptr,len);
SvSETMAGIC(sv);
}
@@ -2401,7 +2401,7 @@ sv_catpv(register SV *sv, register char *ptr)
void
sv_catpv_mg(register SV *sv, register char *ptr)
{
- sv_catpv_mg(sv,ptr);
+ sv_catpv(sv,ptr);
SvSETMAGIC(sv);
}
@@ -2876,13 +2876,15 @@ SV *
sv_newref(SV *sv)
{
if (sv)
- SvREFCNT(sv)++;
+ ATOMIC_INC(SvREFCNT(sv));
return sv;
}
void
sv_free(SV *sv)
{
+ int refcount_is_zero;
+
if (!sv)
return;
if (SvREADONLY(sv)) {
@@ -2897,7 +2899,8 @@ sv_free(SV *sv)
warn("Attempt to free unreferenced scalar");
return;
}
- if (--SvREFCNT(sv) > 0)
+ ATOMIC_DEC_AND_TEST(refcount_is_zero, SvREFCNT(sv));
+ if (!refcount_is_zero)
return;
#ifdef DEBUGGING
if (SvTEMP(sv)) {