summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2003-02-09 23:00:09 +0000
committerhv <hv@crypt.org>2003-02-16 13:08:52 +0000
commit8c4d3c904bc47216a128a948cce979bf46eb0682 (patch)
tree9b637c2d91692337ee0893766a2ba9d8af6a5c48 /sv.h
parent4927db4444d4255bf5c9a54ba1d153bb533bd274 (diff)
downloadperl-8c4d3c904bc47216a128a948cce979bf46eb0682.tar.gz
inline SvREFCNT_dec:
Subject: [PATCH] Copy on write for $& and $1... Message-ID: <20030209230008.GF299@Bagpuss.unfortu.net> p4raw-id: //depot/perl@18725
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sv.h b/sv.h
index 3ba04fefdf..cf408e88f1 100644
--- a/sv.h
+++ b/sv.h
@@ -138,7 +138,22 @@ perform the upgrade if necessary. See C<svtype>.
((PL_Sv=(SV*)(sv)), (PL_Sv && ++(SvREFCNT(PL_Sv))), (SV*)PL_Sv)
#endif
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
+# define SvREFCNT_dec(sv) \
+ ({ \
+ SV *nsv = (SV*)(sv); \
+ if (nsv) { \
+ if (SvREFCNT(nsv)) { \
+ if (--(SvREFCNT(nsv)) == 0) \
+ Perl_sv_free2(aTHX_ nsv); \
+ } else { \
+ sv_free(nsv); \
+ } \
+ } \
+ })
+#else
#define SvREFCNT_dec(sv) sv_free((SV*)(sv))
+#endif
#define SVTYPEMASK 0xff
#define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)