This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In Perl_fbm_instr(), no need to calculate the address of the table if
authorNicholas Clark <nick@ccl4.org>
Fri, 8 Dec 2006 23:49:51 +0000 (23:49 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 8 Dec 2006 23:49:51 +0000 (23:49 +0000)
we're going to return anyway.

p4raw-id: //depot/perl@29492

util.c

diff --git a/util.c b/util.c
index eefb5a5..358af39 100644 (file)
--- a/util.c
+++ b/util.c
@@ -680,12 +680,14 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit
        return b;
     }
 
-    {  /* Do actual FBM.  */
+    /* Do actual FBM.  */
+    if (littlelen > (STRLEN)(bigend - big))
+       return NULL;
+
+    {
        register const unsigned char * const table = little + littlelen + FBM_TABLE_OFFSET;
        register const unsigned char *oldlittle;
 
-       if (littlelen > (STRLEN)(bigend - big))
-           return NULL;
        --littlelen;                    /* Last char found by table lookup */
 
        s = big + littlelen;