Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2001 11:52:10 -0400
From:      Mike Barcroft <mike@FreeBSD.ORG>
To:        "Andrew L. Neporada" <andrew@nas.dgap.mipt.ru>
Cc:        audit@FreeBSD.ORG
Subject:   Re: strnstr(3) - New libc function for review
Message-ID:  <20011010115210.E49828@coffee.q9media.com>
In-Reply-To: <Pine.BSF.4.21.0110101522160.50053-200000@nas.dgap.mipt.ru>; from andrew@nas.dgap.mipt.ru on Wed, Oct 10, 2001 at 03:29:00PM %2B0400
References:  <20011004215706.B34530@coffee.q9media.com> <Pine.BSF.4.21.0110101522160.50053-200000@nas.dgap.mipt.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
[-hackers removed from CC]

Andrew L. Neporada <andrew@nas.dgap.mipt.ru> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011010115210.E49828>