diff options
author | David Mitchell <davem@iabyn.com> | 2016-11-13 14:59:32 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-11-13 15:27:34 +0000 |
commit | 4e8879f34cd1f40280a3be7b04ebda760dcaf0f2 (patch) | |
tree | 159b5857e71a950b6ef5ff46903e6b68e994cf26 /sv.h | |
parent | 5741d7e61dd47767bf5a0fde98f3fe94c6b2f2bb (diff) | |
download | perl-4e8879f34cd1f40280a3be7b04ebda760dcaf0f2.tar.gz |
reduce cost of SvVALID()
Now that SvVALID() no longer just checks an SV flag, but instead checks
for the existence of a certain type of magic, avoid using this more
expensive macro when its not really needed.
Also, and an extra flag test to SvVALID() to make it fail quicker.
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1118,7 +1118,8 @@ object type. Exposed to perl code via Internals::SvREADONLY(). /* Does the SV have a Boyer-Moore table attached as magic? * 'VALID' is a poor name, but is kept for historical reasons. */ #define SvVALID(_svvalid) ( \ - SvSMAGICAL(_svvalid) \ + SvPOKp(_svvalid) \ + && SvSMAGICAL(_svvalid) \ && SvMAGIC(_svvalid) \ && (SvMAGIC(_svvalid)->mg_type == PERL_MAGIC_bm \ || mg_find(_svvalid, PERL_MAGIC_bm)) \ |