This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Save a branch test
authorKarl Williamson <khw@cpan.org>
Mon, 15 Feb 2016 23:27:20 +0000 (16:27 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 19 Feb 2016 17:41:43 +0000 (10:41 -0700)
This branch will only be true if the answer to the previous branch was
also true, so can just move it to within that to avoid an unnecessary
test.

regcomp.c

index c5378fa..a820047 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -18402,10 +18402,10 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
             if (ANYOFL_UTF8_LOCALE_REQD(flags)) {
                 sv_catpvs(sv, "{utf8-locale-reqd}");
             }
+            if (flags & ANYOFL_FOLD) {
+                sv_catpvs(sv, "{i}");
             }
         }
-       if (flags & ANYOFL_FOLD)
-           sv_catpvs(sv, "{i}");
        Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]);
        if (flags & ANYOF_INVERT)
            sv_catpvs(sv, "^");