summaryrefslogtreecommitdiff
path: root/util.c
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 /util.c
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 'util.c')
-rw-r--r--util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util.c b/util.c
index fb2ddec974..88f1700431 100644
--- 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);