This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Don't print incorrect debug info
authorKarl Williamson <public@khwilliamson.com>
Sun, 18 Dec 2011 20:27:06 +0000 (13:27 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 19 Jan 2012 18:58:16 +0000 (11:58 -0700)
The break out of the loop should be done before the debug statements
that indicate the things that happen only if the break isn't done.

regcomp.c

index c8a6e96..a05ae44 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -2554,12 +2554,13 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan, I32 *min, U32 flags
         else if (stringok) {
             const unsigned int oldl = STR_LEN(scan);
             regnode * const nnext = regnext(n);
+
+            if (oldl + STR_LEN(n) > U8_MAX)
+                break;
             
             DEBUG_PEEP("merg",n,depth);
-            
             merged++;
-            if (oldl + STR_LEN(n) > U8_MAX)
-                break;
+
             NEXT_OFF(scan) += NEXT_OFF(n);
             STR_LEN(scan) += STR_LEN(n);
             next = n + NODE_SZ_STR(n);