Commit 8c11f76
committed
Maintain end-of-input sentinel in reset_tokens()
Trunk's WP_MySQL_Parser::reset_tokens() lets the parser be reused across
queries by swapping in a new token array. The performance branch's parser
relies on an end-of-input sentinel token (id = EMPTY_RULE_ID) appended at
$tokens[$token_count] so the hot path can read $tokens[$pos]->id without
a range check; reset_tokens() must reproduce that invariant or the next
parse() walks off the end.
Append the sentinel and update $token_count in reset_tokens(), matching
WP_Parser::__construct().1 parent 873bed5 commit 8c11f76
1 file changed
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
0 commit comments