summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-11-13 14:59:32 +0000
committerDavid Mitchell <davem@iabyn.com>2016-11-13 15:27:34 +0000
commit4e8879f34cd1f40280a3be7b04ebda760dcaf0f2 (patch)
tree159b5857e71a950b6ef5ff46903e6b68e994cf26 /sv.h
parent5741d7e61dd47767bf5a0fde98f3fe94c6b2f2bb (diff)
downloadperl-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.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.h b/sv.h
index b97c17529d..a9aca37bf2 100644
--- a/sv.h
+++ b/sv.h
@@ -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)) \