From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2265 invoked by alias); 29 Nov 2010 14:25:14 -0000 Received: (qmail 2247 invoked by uid 9737); 29 Nov 2010 14:25:14 -0000 Date: Mon, 29 Nov 2010 14:25:00 -0000 Message-ID: <20101129142514.2245.qmail@sourceware.org> From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/libdm/regex matcher.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00072.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2010-11-29 14:25:14 Modified files: libdm/regex : matcher.c Log message: Optimize lookup table read Reread lookup table only when needed. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/regex/matcher.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/libdm/regex/matcher.c 2010/11/29 12:43:49 1.14 +++ LVM2/libdm/regex/matcher.c 2010/11/29 14:25:13 1.15 @@ -372,11 +372,11 @@ { 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)