This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
reduce cost of SvVALID()
[perl5.git] / sv.h
diff --git a/sv.h b/sv.h
index b97c175..a9aca37 100644 (file)
--- 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))         \