diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-22 23:06:30 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-23 00:09:34 -0700 |
commit | 8c17ac6272cec6ea743129ee29c96edb6de4102e (patch) | |
tree | 3b2721ea1e8602d22510581c4c2ab4cc88a6aad8 /toke.c | |
parent | 1d894b9f1f8661108648de072cb25d2979a9528e (diff) | |
download | perl-8c17ac6272cec6ea743129ee29c96edb6de4102e.tar.gz |
toke.c: Merge some mad and sane code
These two code paths are now nearly identical. However, one uses s as
its cursor; the other uses d therefor while using s to remember the
previous position. If we switch the uses of d and s, then outside of
PL_madskills we don’t even need to set d.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 33 |
1 files changed, 11 insertions, 22 deletions
@@ -5593,17 +5593,19 @@ Perl_yylex(pTHX) s = SKIPSPACE0(s); } else { - d = s; - while (d < PL_bufend && *d != '\n') - d++; - if (d < PL_bufend) +#endif + if (PL_madskills) d = s; + while (s < PL_bufend && *s != '\n') + s++; + if (s < PL_bufend) { - d++; - if (d < PL_bufend) - incline(d); + s++; + if (s < PL_bufend) + incline(s); } - else if (d > PL_bufend) /* Found by Ilya: feed random input to Perl. */ + else if (s > PL_bufend) /* Found by Ilya: feed random input to Perl. */ Perl_croak(aTHX_ "panic: input overflow"); +#ifdef PERL_MAD if (PL_madskills && CopLINE(PL_curcop) >= 1) { if (!PL_thiswhite) PL_thiswhite = newSVpvs(""); @@ -5611,22 +5613,9 @@ Perl_yylex(pTHX) sv_setpvs(PL_thiswhite, ""); PL_faketokens = 0; } - sv_catpvn(PL_thiswhite, s, d - s); + sv_catpvn(PL_thiswhite, d, s - d); } - s = d; } -#else - while (s < PL_bufend && *s != '\n') - s++; - if (s < PL_bufend) - { - s++; - if (s < PL_bufend) - incline(s); - } - - else if (s > PL_bufend) /* Found by Ilya: feed random input to Perl. */ - Perl_croak(aTHX_ "panic: input overflow"); #endif } goto retry; |