Compress::Zlib 1.35
[p5sagit/p5-mst-13.2.git] / regcomp.c
index eab68b3..a4e2cc4 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1540,7 +1540,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
 
 
 STATIC I32
-S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, regnode *last, scan_data_t *data, U32 flags, U32 depth)
+S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap,
+                       regnode *last, scan_data_t *data, U32 flags, U32 depth)
                        /* scanp: Start here (read-write). */
                        /* deltap: Write maxlen-minlen here. */
                        /* last: Stop before this one. */
@@ -1888,8 +1889,8 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
 
                         /* dont use tail as the end marker for this traverse */
                         for ( cur = startbranch ; cur != scan ; cur = regnext( cur ) ) {
-                            regnode *noper = NEXTOPER( cur );
-                            regnode *noper_next = regnext( noper );
+                            regnode * const noper = NEXTOPER( cur );
+                            regnode * const noper_next = regnext( noper );
 
                             DEBUG_OPTIMISE_r({
                                 regprop( mysv, cur);
@@ -2001,7 +2002,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
                }
                sv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));
                {
-                   SV * sv = data->last_found;
+                   SV * const sv = data->last_found;
                    MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?
                        mg_find(sv, PERL_MAGIC_utf8) : NULL;
                    if (mg && mg->mg_len >= 0)
@@ -2202,12 +2203,12 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
                }
                if (!scan)              /* It was not CURLYX, but CURLY. */
                    scan = next;
-               if (ckWARN(WARN_REGEXP)
-                      /* ? quantifier ok, except for (?{ ... }) */
-                   && (next_is_eval || !(mincount == 0 && maxcount == 1))
+               if ( /* ? quantifier ok, except for (?{ ... }) */
+                   (next_is_eval || !(mincount == 0 && maxcount == 1))
                    && (minnext == 0) && (deltanext == 0)
                    && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
-                   && maxcount <= REG_INFTY/3) /* Complement check for big count */
+                   && maxcount <= REG_INFTY/3 /* Complement check for big count */
+                   && ckWARN(WARN_REGEXP))
                {
                    vWARN(RExC_parse,
                          "Quantifier unexpected on zero-length expression");
@@ -3838,7 +3839,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
        goto do_curly;
     }
   nest_check:
-    if (ckWARN(WARN_REGEXP) && !SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3) {
+    if (!SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3 && ckWARN(WARN_REGEXP)) {
        vWARN3(RExC_parse,
               "%.*s matches null string many times",
               RExC_parse - origparse,
@@ -4275,7 +4276,7 @@ tryagain:
                            FAIL("Trailing \\");
                        /* FALL THROUGH */
                    default:
-                       if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(*p))
+                       if (!SIZE_ONLY&& isALPHA(*p) && ckWARN(WARN_REGEXP))
                            vWARN2(p + 1, "Unrecognized escape \\%c passed through", UCHARAT(p));
                        goto normal_default;
                    }
@@ -4818,7 +4819,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
                break;
             }
            default:
-               if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(value))
+               if (!SIZE_ONLY && isALPHA(value) && ckWARN(WARN_REGEXP))
                    vWARN2(RExC_parse,
                           "Unrecognized escape \\%c in character class passed through",
                           (int)value);