diff options
author | David Mitchell <davem@iabyn.com> | 2014-02-07 22:33:27 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-02-08 14:04:55 +0000 |
commit | 4ada123379923d0ba0d8620c3d182dfd347c1757 (patch) | |
tree | 90cd86407917c559048a61f5287e528c84840d41 /regexec.c | |
parent | f4f115deb65686550534968f3c480815511ad36c (diff) | |
download | perl-4ada123379923d0ba0d8620c3d182dfd347c1757.tar.gz |
re_intuit_start(): in MBOL block, eliminate t var
Currently we do:
char *t = memchr(rx_origin, '\n');
if (!t) ...
rx_origin = t + 1;
...
Eliminate the t var and just set rx_origin directly:
rx_origin = memchr(rx_origin, '\n');
if (!rx_origin) ...
rx_origin++;
...
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1085,8 +1085,6 @@ Perl_re_intuit_start(pTHX_ /* May be due to an implicit anchor of m{.*foo} */ && !(prog->intflags & PREGf_IMPLICIT)) { - char *t; - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " looking for /^/m anchor")); @@ -1103,27 +1101,29 @@ Perl_re_intuit_start(pTHX_ * first */ - t = (char *)memchr(rx_origin, '\n', + rx_origin = (char *)memchr(rx_origin, '\n', HOP3c(strend, - prog->minlen, strpos) - rx_origin); - if (!t) { + if (!rx_origin) { DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " Did not find /%s^%s/m...\n", PL_colors[0], PL_colors[1])); goto fail_finish; } - /* since *t == '\n', it's safe to do +1 here rather than HOP(t,1) */ - rx_origin = t + 1; /* earliest possible origin is after the \n */ + /* earliest possible origin is 1 char after the \n. + * (since *rx_origin == '\n', it's safe to ++ here rather than + * HOP(rx_origin, 1)) */ + rx_origin++; if (prog->substrs->check_ix == 0 /* check is anchored */ - || t >= HOP3c(check_at, - prog->check_offset_min, strpos)) + || rx_origin >= HOP3c(check_at, - prog->check_offset_min, strpos)) { /* Position contradicts check-string; either because * check was anchored (and thus has no wiggle room), - * or check was float and t is above the float range */ + * or check was float and rx_origin is above the float range */ DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " Found /%s^%s/m, restarting lookup for check-string at offset %ld...\n", - PL_colors[0], PL_colors[1], (long)(t + 1 - strpos))); + PL_colors[0], PL_colors[1], (long)(rx_origin - strpos))); goto restart; } |