summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1997-11-07 23:52:35 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1997-11-07 23:52:35 +0000
commitaeea060ce4b653ecf5b0731f1cbfcf468f688acd (patch)
tree071ed1fbe63cb80bbddce550bd8c0b9942527b3f /sv.h
parente77eedc24c0252a902559034f2aa207f216529cc (diff)
downloadperl-aeea060ce4b653ecf5b0731f1cbfcf468f688acd.tar.gz
Reverse integrate Malcolm's chanes into local
repository, then import result back into my view of Malcolm's repository. Builds and passes (most) tests with GNU C++/Solaris and Borland C++, Win32. p4raw-id: //depot/ansiperl@210
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h32
1 files changed, 23 insertions, 9 deletions
diff --git a/sv.h b/sv.h
index c888d8fcac..fcf92975f4 100644
--- a/sv.h
+++ b/sv.h
@@ -70,6 +70,7 @@ struct io {
#define SvANY(sv) (sv)->sv_any
#define SvFLAGS(sv) (sv)->sv_flags
+#define SvREFCNT(sv) (sv)->sv_refcnt
#ifdef __GNUC__
# define SvREFCNT_inc(sv) ({SV* nsv=(SV*)(sv); if(nsv) ++SvREFCNT(nsv); nsv;})
@@ -82,7 +83,6 @@ struct io {
#endif
#define SvREFCNT_dec(sv) sv_free((SV*)sv)
-#endif
#define SVTYPEMASK 0xff
#define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)
@@ -546,19 +546,33 @@ struct xpvio {
? SvNVX(sv) != 0.0 \
: sv_2bool(sv) )
-#define SvIVx(sv) ((Sv = (sv)), SvIV(Sv))
-#define SvUVx(sv) ((Sv = (sv)), SvUV(Sv))
-#define SvNVx(sv) ((Sv = (sv)), SvNV(Sv))
-#define SvPVx(sv, lp) ((Sv = (sv)), SvPV(Sv, lp))
+#ifdef __GNUC__
+# define SvIVx(sv) ({SV *nsv = (SV*)(sv); SvIV(nsv); })
+# define SvUVx(sv) ({SV *nsv = (SV*)(sv); SvUV(nsv); })
+# define SvNVx(sv) ({SV *nsv = (SV*)(sv); SvNV(nsv); })
+# define SvPVx(sv, lp) ({SV *nsv = (sv); SvPV(nsv, lp); })
+#else
+# define SvIVx(sv) ((Sv = (sv)), SvIV(Sv))
+# define SvUVx(sv) ((Sv = (sv)), SvUV(Sv))
+# define SvNVx(sv) ((Sv = (sv)), SvNV(Sv))
+# define SvPVx(sv, lp) ((Sv = (sv)), SvPV(Sv, lp))
+#endif /* __GNUC__ */
+
#define SvTRUEx(sv) ((Sv = (sv)), SvTRUE(Sv))
#endif /* CRIPPLED_CC */
#define newRV_inc(sv) newRV(sv)
-#ifndef CRIPPLED_CC
-#undef newRV_noinc
-#define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv)
-#endif
+#ifdef __GNUC__
+# undef newRV_noinc
+# define newRV_noinc(sv) ({SV *nsv=newRV((sv)); --SvREFCNT(SvRV(nsv)); nsv;})
+#else
+# if defined(CRIPPLED_CC) || defined(USE_THREADS)
+# else
+# undef newRV_noinc
+# define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv)
+# endif
+#endif /* __GNUC__ */
/* the following macro updates any magic values this sv is associated with */