This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Expand out macro in only remaining use
authorKarl Williamson <khw@cpan.org>
Sun, 18 Nov 2018 22:12:02 +0000 (15:12 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 27 Nov 2018 05:24:33 +0000 (22:24 -0700)
There is only one call to this macro.  It's easier to understand if
expanded out instead of the call.  The next commit will refactor.

regexec.c

index 9dbaeaa..582b031 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -107,13 +107,6 @@ static const char* const non_utf8_target_but_utf8_required
 #define        STATIC  static
 #endif
 
-/* Valid only if 'c', the character being looke-up, is an invariant under
- * UTF-8: it avoids the reginclass call if there are no complications: i.e., if
- * everything matchable is straight forward in the bitmap */
-#define REGINCLASS(prog,p,c,u)  (ANYOF_FLAGS(p)                             \
-                                ? reginclass(prog,p,c,c+1,u)                \
-                                : ANYOF_BITMAP_TEST(p,*(c)))
-
 /*
  * Forwards.
  */
@@ -6714,7 +6707,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                locinput += UTF8SKIP(locinput);
            }
            else {
-               if (!REGINCLASS(rex, scan, (U8*)locinput, utf8_target))
+               if (ANYOF_FLAGS(scan)
+                    ? ! reginclass(rex, scan, (U8*) locinput, (U8*) locinput+1, utf8_target)
+                    : ! ANYOF_BITMAP_TEST(scan, *(U8*) locinput))
                    sayNO;
                locinput++;
            }