summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-05-22 10:40:55 +0100
committerDavid Mitchell <davem@iabyn.com>2012-06-13 13:32:53 +0100
commit7e1a2c8d3379302594e45d7ac3b09fd4b6477ffc (patch)
tree5d0e695aeea423523e3c1b4dc5658960f9e28308 /pp_hot.c
parentf067efbfa97c3658b1cf186884f09e38fcee1876 (diff)
downloadperl-7e1a2c8d3379302594e45d7ac3b09fd4b6477ffc.tar.gz
pp_match(): clarify intuit parens behaviour
There was some dodgy code, (flagged by dmq), that as well as setting RX_LASTPAREN(rx), RX_LASTCLOSEPAREN(rx) to zero, also set RX_NPARENS(rx) to zero. The actual logic is that if we reach that point, the pattern shouldn't have any capturing parentheses, so instead of assigning zero to it, assert that RX_NPARENS(rx) is zero.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 93d5a1f7b1..17d1e8f55b 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1527,9 +1527,9 @@ yup: /* Confirmed by INTUIT */
RX_OFFS(rx)[0].start = s - truebase;
RX_OFFS(rx)[0].end = s - truebase + RX_MINLENRET(rx);
}
- /* including RX_NPARENS(rx) in the below code seems highly suspicious.
- -dmq */
- RX_NPARENS(rx) = RX_LASTPAREN(rx) = RX_LASTCLOSEPAREN(rx) = 0; /* used by @-, @+, and $^N */
+ /* match via INTUIT shouldn't have any captures. Let @-, @+, $^N know */
+ assert(!RX_NPARENS(rx));
+ RX_LASTPAREN(rx) = RX_LASTCLOSEPAREN(rx) = 0;
LEAVE_SCOPE(oldsave);
RETPUSHYES;