diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2010-11-29 14:25:13 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2010-11-29 14:25:13 +0000 |
commit | 2e3be4f3fd71f572000aa97e27a948524be0dbaa (patch) | |
tree | d49ffb11d8284fc5864141d06a11550747bde014 /libdm/regex | |
parent | b20e74d5d6bcb8024b5b0ce8e619c67cd7a97f76 (diff) | |
download | lvm2-2e3be4f3fd71f572000aa97e27a948524be0dbaa.tar.gz |
Optimize lookup table read
Reread lookup table only when needed.
Diffstat (limited to 'libdm/regex')
-rw-r--r-- | libdm/regex/matcher.c | 10 |
1 files 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) |