This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Use fewer branches
authorKarl Williamson <khw@cpan.org>
Tue, 13 Dec 2016 02:36:36 +0000 (19:36 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 23 Dec 2016 23:48:34 +0000 (16:48 -0700)
This code is true for all ASCII space characters except \n.  Rather
than enumerating them with a branch each, use a single lookup, and then
exclude \n

toke.c

diff --git a/toke.c b/toke.c
index 2992cc7..09fcddc 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -11145,8 +11145,7 @@ S_scan_formline(pTHX_ char *s)
        PL_expect = XSTATE;
        if (needargs) {
            const char *s2 = s;
-           while (   *s2 == '\r' || SPACE_OR_TAB(*s2) || *s2 == '\f'
-                   || *s2 == '\v')
+           while (isSPACE(*s2) && *s2 != '\n')
                s2++;
            if (*s2 == '{') {
                PL_expect = XTERMBLOCK;