From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2832 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: strcasestr.c Date: Fri, 22 Feb 2013 00:20:17 -0500 Message-ID: <20130222052016.GR20323@brightrain.aerifal.cx> References: <201302141459.r1EExuU3024259@core.courtesan.com> <20130214152349.GA20323@brightrain.aerifal.cx> <20130217190452.GH20323@brightrain.aerifal.cx> <51254E0F.7010206@barfooze.de> <20130221010328.GN20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1361510431 24099 80.91.229.3 (22 Feb 2013 05:20:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Feb 2013 05:20:31 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2833-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 22 06:20:54 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U8l3z-0001BR-78 for gllmg-musl@plane.gmane.org; Fri, 22 Feb 2013 06:20:51 +0100 Original-Received: (qmail 30477 invoked by uid 550); 22 Feb 2013 05:20:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30469 invoked from network); 22 Feb 2013 05:20:29 -0000 Content-Disposition: inline In-Reply-To: <20130221010328.GN20323@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2832 Archived-At: On Wed, Feb 20, 2013 at 08:03:28PM -0500, Rich Felker wrote: > My leaning right now would be to write the naive strstr loop using > strcasecmp instead of strcmp (or an inline loop) for the inner loop. > This will cause strcasestr to have the exact same case-folding > semantics as strcasecmp, whatever those are in the future. This is > best for consistency. Unfortunately, it's very bad from a performance > standpoint, but I don't know of any code using this function for > high-performance use. I just committed an utterly trivial, working strcasestr based on this principle. At least it's better than what we had before. I hope nobody objects too much. It's 79 bytes of code (97 bytes for PIC) on x86 and that's with -O3. Rich