From e0a4b67e11dde7f0286b1de27d8f7907501f2ff7 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 29 Nov 2010 14:25:13 +0000 Subject: [PATCH] Optimize lookup table read Reread lookup table only when needed. --- libdm/regex/matcher.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdm/regex/matcher.c b/libdm/regex/matcher.c index 0c98fcc30..eb20bd093 100644 --- a/libdm/regex/matcher.c +++ b/libdm/regex/matcher.c @@ -372,11 +372,11 @@ static struct dfa_state *_step_matcher(struct dm_regex *m, int c, struct dfa_sta { struct dfa_state *ns; - if (!cs->lookup[(unsigned char) c]) - _calc_state(m, cs, (unsigned char) c); - - if (!(ns = cs->lookup[(unsigned char) c])) - return NULL; + if (!(ns = cs->lookup[(unsigned char) c])) { + _calc_state(m, cs, (unsigned char) c); + if (!(ns = cs->lookup[(unsigned char) c])) + return NULL; + } // yuck, we have to special case the target trans if (ns->final == -1) -- 2.43.5