From owner-freebsd-audit Wed Oct 10 8:51:10 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id B1E3737B40B for ; Wed, 10 Oct 2001 08:51:07 -0700 (PDT) Received: (from mike@localhost) by coffee.q9media.com (8.11.6/8.11.6) id f9AFqBG51796; Wed, 10 Oct 2001 11:52:11 -0400 (EDT) (envelope-from mike) Date: Wed, 10 Oct 2001 11:52:10 -0400 From: Mike Barcroft To: "Andrew L. Neporada" Cc: audit@FreeBSD.ORG Subject: Re: strnstr(3) - New libc function for review Message-ID: <20011010115210.E49828@coffee.q9media.com> References: <20011004215706.B34530@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ; from andrew@nas.dgap.mipt.ru on Wed, Oct 10, 2001 at 03:29:00PM +0400 Organization: The FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [-hackers removed from CC] Andrew L. Neporada writes: > I think you should write in ststr.3 that strnstr locates first occurrence > of null-terminated string 'little' in ___null-terminated___ string 'big'. No, that's inconsistent with existing strn...() functions and totally defeats the purpose of my addition. To quote from my patch: : Add a new libc function, strnstr(3), which allows one to limit the : number of characters that are searched. This is especially useful : with file operations and non-NUL terminated strings. > P.S. Because str(n)str functions deal with null-terminated strings > (i.e. we don't know sizes of strings), it is impossible to write > algorithm, that will work faster (in average) than current implementation. See above. > P.P.S. In the case of binary strings it is possible to implement faster > search -- see attachment. Yes. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message