summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-01-12 10:26:15 +0000
committerDavid Mitchell <davem@iabyn.com>2013-01-12 16:34:40 +0000
commit3041a168eaf8027c9e376a53450bcb825f527da8 (patch)
treeca690cb3143ea83f3436b621f8d8a32543482b8a /sv.h
parentf5d13a25262cb242090ad5e0703cf287e26156db (diff)
downloadperl-3041a168eaf8027c9e376a53450bcb825f527da8.tar.gz
include SvREADONLY() in SvIMMORTAL() test
SvIMMORTAL() is currently defined as ((sv)==&PL_sv_undef || (sv)==&PL_sv_yes || (sv)==&PL_sv_no || (sv)==&PL_sv_placeholder) Which is relatively slow. Some places do this: if (SvREADONLY(sv) && SvIMMORTAL(sv)) ... which quickly rejects most times. This commit simply moves the SvREADONLY test into the SvIMMORTAL macro so that *all* uses benefit from this speedup.
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sv.h b/sv.h
index 8b07ee9b57..5e14252ccb 100644
--- a/sv.h
+++ b/sv.h
@@ -2061,7 +2061,7 @@ alternative is to call C<sv_grow> if you are not sure of the type of SV.
#define SvPEEK(sv) ""
#endif
-#define SvIMMORTAL(sv) ((sv)==&PL_sv_undef || (sv)==&PL_sv_yes || (sv)==&PL_sv_no || (sv)==&PL_sv_placeholder)
+#define SvIMMORTAL(sv) (SvREADONLY(sv) && ((sv)==&PL_sv_undef || (sv)==&PL_sv_yes || (sv)==&PL_sv_no || (sv)==&PL_sv_placeholder))
#ifdef DEBUGGING
/* exercise the immortal resurrection code in sv_free2() */