diff options
author | David Mitchell <davem@iabyn.com> | 2013-01-12 10:26:15 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-01-12 16:34:40 +0000 |
commit | 3041a168eaf8027c9e376a53450bcb825f527da8 (patch) | |
tree | ca690cb3143ea83f3436b621f8d8a32543482b8a /sv.h | |
parent | f5d13a25262cb242090ad5e0703cf287e26156db (diff) | |
download | perl-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.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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() */ |