Commit Graph

11 Commits

Author SHA1 Message Date
Ed Maste
22ccf855bf libc: update strstr implementation to match musl
musl commits:
122d67f846cb0be2c9e1c3880db9eb9545bbe38c
0239cd0681e889a269fb7691f60e81ef8d081e6b
8f5a820d147da36bcdbddd201b35d293699dacd8

Submitted by:	David CARLIER <devnexen_gmail.com>
Obtained from:	musl
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D19834
2019-04-09 15:52:18 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Ed Maste
01dc206b22 libc: add reference to two-way algorithm and bad shift table in memmem/strstr
Requested by:	ed
2017-03-18 00:53:24 +00:00
Ed Maste
88521634e9 libc: Use musl's O(n) memmem and strstr
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
2017-03-18 00:51:39 +00:00
Ed Maste
3fb3b97c4d Renumber clauses to reduce diffs to other versions
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
2013-05-28 20:57:40 +00:00
Daniel Gerzo
bd604b4b06 - ANSIfy function definitions
- use nul when we are looking for a terminating character where appropriate

Approved by:	imp
2009-02-03 17:58:20 +00:00
Warner Losh
c879ae3536 Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.
2007-01-09 00:28:16 +00:00
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
David E. O'Brien
de5fe5d53b rcsid[]->__FBSDID 2001-11-07 19:55:16 +00:00
David E. O'Brien
5864b79cd2 Make the rcsid and FreeBSD IDs more sane in the wcs* and wmem* files.
Do the same for the non-wcs*/wmem* files while I'm here.
2001-05-24 08:47:42 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00