This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Simplify a short code section
authorKarl Williamson <khw@cpan.org>
Thu, 28 Aug 2014 04:12:02 +0000 (22:12 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 3 Sep 2014 18:43:14 +0000 (12:43 -0600)
Two "if"s can be combined, leading to one fewer (unoptimized) tests

regexec.c

index b6d163e..f4bb069 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -7685,12 +7685,12 @@ S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8* const
            match = TRUE;
        }
        else if (flags & ANYOF_LOCALE_FLAGS) {
-           if (flags & ANYOF_LOC_FOLD) {
-                if (ANYOF_BITMAP_TEST(n, PL_fold_locale[c])) {
-                    match = TRUE;
-                }
+           if ((flags & ANYOF_LOC_FOLD)
+               && ANYOF_BITMAP_TEST(n, PL_fold_locale[c]))
+            {
+                match = TRUE;
             }
-           if (! match && ANYOF_POSIXL_TEST_ANY_SET(n)) {
+            else if (ANYOF_POSIXL_TEST_ANY_SET(n)) {
 
                 /* The data structure is arranged so bits 0, 2, 4, ... are set
                  * if the class includes the Posix character class given by