summaryrefslogtreecommitdiff
path: root/lib/libc/string
Commit message (Collapse)AuthorAgeFilesLines
* MFC r205099-205100,205108:Xin LI2010-05-131-25/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two optimizations to MI strlen(3) inspired by David S. Miller's blog posting [1]. - Use word-sized test for unaligned pointer before working the hard way. Memory page boundary is always integral multiple of a word alignment boundary. Therefore, if we can access memory referenced by pointer p, then (p & ~word mask) must be also accessible. - Better utilization of multi-issue processor's ability of concurrency. The previous implementation utilized a formular that must be executed sequentially. However, the ~, & and - operations can actually be caculated at the same time when the operand were different and unrelated. The original Hacker's Delight formular also offered consistent performance regardless whether the input would contain characters with their highest-bit set, as it catches real nul characters only. These two optimizations has shown further improvements over the previous implementation on microbenchmarks on i386 and amd64 CPU including Pentium 4, Core Duo 2 and i7. [1] http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/03/08#strlen_1 Notes: svn path=/stable/8/; revision=208051
* MFC r202916: Make strsignal(3) thread-safe.Hajimu UMEMOTO2010-02-071-4/+48
| | | | Notes: svn path=/stable/8/; revision=203598
* MFC: r199988Christian Brueffer2009-12-041-2/+3
| | | | | | | Add an .Nm for strncat. Notes: svn path=/stable/8/; revision=200092
* Correct the information about when the respective functionality firstChristian Brueffer2009-04-231-1/+1
| | | | | | | | | | | appeared in FreeBSD. PR: 133785 Submitted by: Ulrich Spoerlein <uqs@spoerlein.net> MFC after: 3 days Notes: svn path=/head/; revision=191414
* There is no way for strmode(3) to append '+' if the file has ACL,Edward Tomasz Napierala2009-04-142-4/+2
| | | | | | | | because there is no way to figure that out based on the file mode itself. Make the manual page match reality. Notes: svn path=/head/; revision=191055
* Add wide character variants of string manipulations routines to 'SEE ALSO'.Edward Tomasz Napierala2009-04-0716-16/+33
| | | | | | | Approved by: rwatson (mentor) Notes: svn path=/head/; revision=190798
* 7.2 will be the first release where strndup() appears.Konstantin Belousov2009-03-221-1/+1
| | | | | | | | Submitted by: Florian Smeets <flo kasimir com> MFC after: 3 days Notes: svn path=/head/; revision=190266
* Add wcpcpy(3) and wcpncpy(3).David Schultz2009-03-045-3/+108
| | | | Notes: svn path=/head/; revision=189361
* Add restrict qualifiers.David Schultz2009-02-281-1/+1
| | | | | | | I missed this file in my previous commit. Notes: svn path=/head/; revision=189137
* - Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),David Schultz2009-02-2810-21/+312
| | | | | | | | | | | | | | | wcscasecmp(), and wcsncasecmp(). - Make some previously non-standard extensions visible if POSIX_VISIBLE >= 200809. - Use restrict qualifiers in stpcpy(). - Declare off_t and size_t in stdio.h. - Bump __FreeBSD_version in case the new symbols (particularly getline()) cause issues with ports. Reviewed by: standards@ Notes: svn path=/head/; revision=189136
* Add restrict qualifiers to the parameters to strlcpy() and strlcat().David Schultz2009-02-283-4/+4
| | | | | | | | The annotation mainly just serves as a hint that they're not intended for use with overlapping strings. Notes: svn path=/head/; revision=189133
* Make sure the comparison is done with an unsigned char.Warner Losh2009-02-071-1/+1
| | | | Notes: svn path=/head/; revision=188295
* Fix the functions to match prototypes. The K&R definitions differWarner Losh2009-02-033-3/+3
| | | | | | | from the ANSI-C prototype due to the 'int promotion' rule. Notes: svn path=/head/; revision=188098
* - ANSIfy function definitionsDaniel Gerzo2009-02-0333-110/+41
| | | | | | | | | - use nul when we are looking for a terminating character where appropriate Approved by: imp Notes: svn path=/head/; revision=188080
* - Fix grammar. [1]Xin LI2009-01-261-3/+3
| | | | | | | | | | | - Use the correct term 'long mode'. [2] - style(9) for return value. [3] Submitted by: Ben Kaduk <minimarmot gmail com> [1], obrien [2], scf [3] Notes: svn path=/head/; revision=187707
* Rewrite of MI strlen(3) in a way that can better utilize modern hardware byXin LI2009-01-251-15/+78
| | | | | | | | | | | | reducing branches and doing word-sized operation. The idea is taken from J.T. Conklin's x86_64 optimized version of strlen(3) for NetBSD, and reimplemented in C by me. Discussed on: -arch@ Notes: svn path=/head/; revision=187700
* Document that ffsll(3) and flsll(3) functions first appeared inKonstantin Belousov2009-01-131-1/+1
| | | | | | | | | | FreeBSD 7.1 Submitted by: Jan Henrik Sylvester <me janh de> MFC after: 3 days Notes: svn path=/head/; revision=187147
* o Language improvements from OpenBSD;Xin LI2009-01-121-17/+17
| | | | | | | | | o Use an ISC-style license as did by the author. Obtained from: OpenBSD Notes: svn path=/head/; revision=187091
* o ANSIfy.Xin LI2009-01-121-29/+12
| | | | | | | | | o Use ISC style copyright as did by the author. Obtained from: OpenBSD Notes: svn path=/head/; revision=187090
* Sort MLINKS.Ruslan Ermilov2009-01-091-21/+32
| | | | Notes: svn path=/head/; revision=186957
* o Use full month name in .Dd macro.Maxim Konovalov2008-12-091-1/+1
| | | | Notes: svn path=/head/; revision=185789
* Import the strndup(3) function.Konstantin Belousov2008-12-064-3/+75
| | | | | | | | | | | Copyright attribution is kept the same as in original NetBSD source. Submitted by: Florian Smeets <flo kasimir com> Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=185690
* Order the str*.c files mostly alphabetical.Konstantin Belousov2008-12-061-3/+3
| | | | | | | | Submitted by: Florian Smeets <flo kasimir com> MFC after: 2 weeks Notes: svn path=/head/; revision=185689
* Add an easier example.Pawel Jakub Dawidek2008-12-051-1/+16
| | | | | | | Reviewed by: trasz Notes: svn path=/head/; revision=185641
* Add the ffsll and flsll functions. These are ffs and fls operatingKonstantin Belousov2008-11-035-8/+122
| | | | | | | | | | | on long long arguments. Reviewed by: bde (previous version, that included asm implementation for all ffs and fls functions on i386 and amd64) MFC after: 2 weeks Notes: svn path=/head/; revision=184587
* Fix style.Konstantin Belousov2008-11-031-1/+1
| | | | Notes: svn path=/head/; revision=184586
* - License change to a less restrictive one;Xin LI2008-10-191-33/+16
| | | | | | | | | | | - ANSIfy; - Convert do {} while loop -> while {} for clarity; - Sync RCS ID with OpenBSD; Obtained from: OpenBSD Notes: svn path=/head/; revision=184059
* Further simplify the code.Xin LI2008-10-191-11/+2
| | | | | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de> Notes: svn path=/head/; revision=184055
* Use strlcpy() in !localized case to avoid the -1's.Xin LI2008-10-171-2/+1
| | | | Notes: svn path=/head/; revision=183990
* Add memrchr(3).Xin LI2008-04-104-4/+74
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=178051
* Remove license clause 3 to agree with the now-standard BSD license.Wes Peters2007-12-123-14/+0
| | | | | | | Prompted by: Glenn Halperin, Symbian Software Notes: svn path=/head/; revision=174553
* Use C comments since we now preprocess these files with CPP.Daniel Eischen2007-04-291-2/+4
| | | | Notes: svn path=/head/; revision=169092
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-0968-272/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Don't say "rightmost" when referring to the least significant bit.Ruslan Ermilov2006-10-121-4/+5
| | | | | | | | PR: docs/94803 MFC after: 3 days Notes: svn path=/head/; revision=163274
* Improve the wording. Remove the appositive about strcmp, putting theDima Dorfman2006-08-141-2/+5
| | | | | | | | first sentence back to the way it was. Add a second sentence that explains the case when strcmp is called. Notes: svn path=/head/; revision=161274
* o Make grep ^strlcpy work: put a return value type on separate line.Maxim Konovalov2006-06-151-1/+2
| | | | Notes: svn path=/head/; revision=159644
* Add each directory's symbol map file to SYM_MAPS.Daniel Eischen2006-03-131-0/+2
| | | | Notes: svn path=/head/; revision=156613
* Add symbol maps and initial symbol version definitions to libc.Daniel Eischen2006-03-131-0/+80
| | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=156608
* 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
* Remove references to nonexistent "FreeBSD Security Architecture" document.Tim J. Robbins2005-09-052-10/+0
| | | | Notes: svn path=/head/; revision=149792
* Added a sentence to explain what "span" means.Gary W. Swearingen2005-08-292-1/+15
| | | | | | | | | | PR: docs/84850 Submitted by: garys MFC after: 3 days Approved by: keramida Notes: svn path=/head/; revision=149603
* Add the function memmem(3) as found in glibc and others.Andre Oppermann2005-08-256-5/+159
| | | | | | | | | | | | | 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
* Add an implementation of the semi-standard wcsdup() function, as foundTim J. Robbins2005-08-133-4/+53
| | | | | | | on Microsoft and GNU systems. Notes: svn path=/head/; revision=149011
* Replace the current strspn() and strcspn() with significantly fasterDavid Schultz2005-04-022-67/+79
| | | | | | | | | | | | implementations inspired by the ones in DragonFly. Unlike the DragonFly versions, these have a small data cache footprint, and my tests show that they're never slower than the old code except when the charset or the span is 0 or 1 characters. This implementation is generally faster than DragonFly until either the charset or the span gets in the ballpark of 32 to 64 characters. Notes: svn path=/head/; revision=144545
* Unbreak strsignal(). This is an MFC candidate.Maxime Henrion2005-03-061-2/+3
| | | | | | | Reported by: Sean McNeil <sean@mcneil.com> Notes: svn path=/head/; revision=143166
* Unbreak !NLS caseAlexey Zelkin2005-02-272-2/+2
| | | | Notes: svn path=/head/; revision=142693
* Add NLS catalogs support to strerror(), strerror_r() and strsignal().Alexey Zelkin2005-02-272-29/+97
| | | | | | | | | Controlled by NLS define, currently disabled by default. Idea obtained from: NetBSD Notes: svn path=/head/; revision=142667
* Don't read more than the given 'len' bytes from the 'big' string.Pawel Jakub Dawidek2005-02-111-1/+1
| | | | | | | | | PR: misc/77369 Submitted by: Ed Maste <emaste@phaedrus.sandvine.ca> MFC after: 1 week Notes: svn path=/head/; revision=141701
* Sort sections.Ruslan Ermilov2005-01-201-8/+8
| | | | Notes: svn path=/head/; revision=140505