From owner-svn-src-user@FreeBSD.ORG Fri Sep 2 20:34:22 2011 Return-Path: Delivered-To: svn-src-user@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0038F1065672; Fri, 2 Sep 2011 20:34:21 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id AA25F8FC28; Fri, 2 Sep 2011 20:34:21 +0000 (UTC) Received: from server.mypc.hu (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 14B6414E5EEC; Fri, 2 Sep 2011 22:34:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at server.mypc.hu Received: from server.mypc.hu ([127.0.0.1]) by server.mypc.hu (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rdaPy8s6qPtA; Fri, 2 Sep 2011 22:34:16 +0200 (CEST) Received: from [192.168.1.106] (catv-80-98-232-12.catv.broadband.hu [80.98.232.12]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id C707E14DB679; Fri, 2 Sep 2011 22:34:16 +0200 (CEST) Message-ID: <4E613DC4.9010809@FreeBSD.org> Date: Fri, 02 Sep 2011 22:34:12 +0200 From: Gabor Kovesdan User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0a1) Gecko/20110822 Thunderbird/9.0a1 MIME-Version: 1.0 To: Andrey Chernov , src-committers@FreeBSD.ORG, svn-src-user@FreeBSD.ORG References: <201109021818.p82IIO73010722@svn.freebsd.org> <20110902184842.GA28351@vniz.net> In-Reply-To: <20110902184842.GA28351@vniz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r225347 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2011 20:34:22 -0000 On 2011.09.02. 20:48, Andrey Chernov wrote: > On Fri, Sep 02, 2011 at 06:18:24PM +0000, Gabor Kovesdan wrote: >> { \ >> char c = islower(fg->pattern[i]) ? toupper(fg->pattern[i]) \ >> : tolower(fg->pattern[i]); \ >> - fg->qsBc[(unsigned)c] = fg->len - i; \ >> + fg->qsBc[(unsigned char)c] = fg->len - i; \ > > It looks like there should be > > char c = islower((unsigned char)fg->pattern[i]) ? \ > toupper((unsigned char)fg->pattern[i]) : \ > tolower((unsigned char)fg->pattern[i]); \ > > I don't see whole code, it depends on what type fg->pattern[i] have. It's a char. > > Due to their bad design ctype macros can't be called directly on signed > (i.e. default) char type, unless its value is known to be 7bit. Yes, thanks, a cast is missing here, too. > BTW, I don't understand the intention of that expression. > You turn lower to upper and upper to lower. Ignore case mode converts all > to single case instead. It's about the quick search algorithm. Instead of converting _everything_ to single case I store shift values for both cases in the pattern compilation phase, which is executed only once and then the match phase, which may be executed several times, needs to perform much less operations and only convert a few characters. Gabor