From 65048613e49787ec9cd4c2b065b55caf0d7626fa Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 25 Dec 2004 15:03:44 +0000 Subject: [PATCH] speed up transit_state_mb 2004-12-27 Paolo Bonzini * lib/regexec.c (transit_state_mb): Do not examine nodes where the ACCEPT_MB is not set. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-30 --- lib/regexec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/regexec.c b/lib/regexec.c index bd1b491..dde600b 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -2469,10 +2469,13 @@ transit_state_mb (mctx, pstate) { re_node_set dest_nodes, *new_nodes; int cur_node_idx = pstate->nodes.elems[i]; - int naccepted = 0, dest_idx; + int naccepted, dest_idx; unsigned int context; re_dfastate_t *dest_state; + if (!dfa->nodes[cur_node_idx].accept_mb) + continue; + if (dfa->nodes[cur_node_idx].constraint) { context = re_string_context_at (&mctx->input, @@ -2484,9 +2487,8 @@ transit_state_mb (mctx, pstate) } /* How many bytes the node can accept? */ - if (dfa->nodes[cur_node_idx].accept_mb) - naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input, - re_string_cur_idx (&mctx->input)); + naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input, + re_string_cur_idx (&mctx->input)); if (naccepted == 0) continue; @@ -2500,9 +2502,7 @@ transit_state_mb (mctx, pstate) #ifdef DEBUG assert (dfa->nexts[cur_node_idx] != -1); #endif - /* `cur_node_idx' may point the entity of the OP_CONTEXT_NODE, - then we use pstate->nodes.elems[i] instead. */ - new_nodes = dfa->eclosures + dfa->nexts[pstate->nodes.elems[i]]; + new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; dest_state = mctx->state_log[dest_idx]; if (dest_state == NULL)