summaryrefslogtreecommitdiff
path: root/lib/libc/string/memmem.3
Commit message (Collapse)AuthorAgeFilesLines
* libc: Use musl's O(n) memmem and strstrEd Maste2017-03-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | It is O(n) in the length of the haystack (big) string, and has special cases for short needle (little) strings, of one to four bytes, to avoid excessive overhead. There are a small set of nearly trivial cases where the startup overhead of the musl implementation makes it slightly slower -- for example, a 31 byte needle that matches the beginning of the haystack. It's faster for non-trivial cases, and significantly so for inputs that trigger worst- case behaviour of the previous implementation. As an example, in my tests a 16K needle that matches the end of a 64K haystack is nearly 2000x faster with this implementation. Reviewed by: bapt (earlier), ed (earlier) Obtained from: musl (snapshot at commit c718f9fc) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2601 Notes: svn path=/head/; revision=315467
* memmem(3): empty little string matches the beginning of the big stringEd Maste2015-05-261-8/+14
| | | | | | | | | | | | | | | This function originated in glibc, and this matches their behaviour (and NetBSD, OpenBSD, and musl). An empty big string (arg "l") is handled by the existing l_len < s_len test. Reviewed by: bapt, ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2657 Notes: svn path=/head/; revision=283584
* use .Mt to mark up email addresses consistently (part4)Baptiste Daroussin2014-06-231-1/+1
| | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de> Notes: svn path=/head/; revision=267774
* Fix prototype.Ruslan Ermilov2005-11-241-2/+2
| | | | Notes: svn path=/head/; revision=152746
* Fix up markup.Ruslan Ermilov2005-11-181-7/+9
| | | | Notes: svn path=/head/; revision=152571
* Add the function memmem(3) as found in glibc and others.Andre Oppermann2005-08-251-0/+84
It is the binary equivalent to strstr(3). void *memmem(const void *big, size_t big_len, const void *little, size_t little_len); Submitted by: Pascal Gloor <pascal.gloor at spale.com> MFC after: 3 days Notes: svn path=/head/; revision=149466