This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
reduce cost of SvVALID()
[perl5.git] / util.c
diff --git a/util.c b/util.c
index fb2ddec..88f1700 100644 (file)
--- a/util.c
+++ b/util.c
@@ -811,7 +811,8 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U
     const unsigned char *little = (const unsigned char *)SvPV_const(littlestr,l);
     STRLEN littlelen = l;
     const I32 multiline = flags & FBMrf_MULTILINE;
-    bool tail = SvVALID(littlestr) ? cBOOL(SvTAIL(littlestr)) : FALSE;
+    bool valid = SvVALID(littlestr);
+    bool tail = valid ? cBOOL(SvTAIL(littlestr)) : FALSE;
 
     PERL_ARGS_ASSERT_FBM_INSTR;
 
@@ -945,7 +946,7 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U
        return NULL;
     }
 
-    if (!SvVALID(littlestr)) {
+    if (!valid) {
         /* not compiled; use Perl_ninstr() instead */
        char * const b = ninstr((char*)big,(char*)bigend,
                         (char*)little, (char*)little + littlelen);