summaryrefslogtreecommitdiffstats
path: root/include/string.h
Commit message (Collapse)AuthorAgeFilesLines
* FreeBSD uses #if __BSD_VISIBLE to hide non-standard functions, fix this.zeising2013-02-141-1/+1
| | | | | Noticed by: kib Approved by: kib
* Add strchrnul(), a GNU function similar to strchr(), except that it returnszeising2013-02-131-0/+3
| | | | | | | a pointer to the end of the string, rather than NULL, if the character was not found. Approved by: theraven
* Correctly expose xlocale functions if people include the headers in the wrongtheraven2012-03-281-1/+1
| | | | | | order (as some ports apparently do). Approved by: dim (mentor)
* Reapply 227753 (xlocale cleanup), plus some fixes so that it passes buildtheraven2012-03-041-0/+4
| | | | | | universe with gcc. Approved by: dim (mentor)
* Revert r231673 and r231682 for now, until we can run a full makedim2012-02-141-4/+0
| | | | | | universe with them. Sorry for the breakage. Pointy hat to: me and brooks
* Cleanup of xlocale:theraven2012-02-141-0/+4
| | | | | | | | | | | | | | | | - Address performance regressions encountered by das@ by caching per-thread data in TLS where available. - Add a __NO_TLS flag to cdefs.h to indicate where not available. - Reorganise the xlocale.h definitions into xlocale/*.h so that they can be included from multiple places. - Export the POSIX2008 subset of xlocale when POSIX2008 says it should be exported, independently of whether xlocale.h is included. - Fix the bug where programs using ctype functions always assumed ASCII unless recompiled. - Fix some style(9) violations. Reviewed by: brooks (mentor) Approved by: dim (mentor)
* Remove the Berkeley clause 3's.imp2010-02-161-5/+1
| | | | Add a few $FreeBSD$
* Namespace: memccpy() and memchr() are XSI, and memrchr() is a BSD extension.das2009-03-141-1/+3
|
* - Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),das2009-02-281-2/+10
| | | | | | | | | | | | 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@
* Add restrict qualifiers to the parameters to strlcpy() and strlcat().das2009-02-281-2/+2
| | | | | The annotation mainly just serves as a hint that they're not intended for use with overlapping strings.
* Mark memmem() __pure.das2009-02-281-1/+1
|
* Add a function attribute called `__malloc_like', which informs gccdas2009-01-311-2/+2
| | | | | | | | | | | | | | that the annotated function returns a pointer that doesn't alias any extant pointer. This results in a 50%+ speedup in microbenchmarks such as the following: char *cp = malloc(1), *buf = malloc(BUF); for (i = 0; i < BUF; i++) buf[i] = *cp; In real programs, your mileage will vary. Note that gcc already performs this optimization automatically for any function called `malloc', `calloc', `strdup', or `strndup' unless -fno-builtins is used.
* Add strndup(3) prototype to string.h.kib2008-12-081-0/+1
| | | | | | | | | | | This change was erronously ommitted from the r185690, and attempt to simply add the prototype to string.h has revealed that several contributed programs defined local prototypes for strndup(), controlled by autoconfed config.h. So, manually change #undef HAVE_STRNDUP to #define HAVE_STRNDUP 1. Next import of the corresponding program would regenerate config.h, overriding the changes in this commit. No objections from: kan
* Add memrchr(3).delphij2008-04-101-0/+1
| | | | Obtained from: OpenBSD
* Revert last revision, strmode() should be moved to <unistd.h> to beru2005-11-241-1/+1
| | | | properly fixed.
* Fix prototype of strmode() to match the code and documentation.ru2005-11-241-1/+1
|
* Appropriate namespace protection for memmem(3).andre2005-08-251-0/+2
| | | | | Submitted by: wollman MFC after: 3 days
* Add the function memmem(3) as found in glibc and others.andre2005-08-251-0/+1
| | | | | | | | | | 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
* According to the information on:trhodes2004-12-101-2/+13
| | | | | | | | | | | http://www.opengroup.org/onlinepubs/009695399/functions/swab.html the prototype for swab() should be in <unistd.h> and not in <string.h>. Move it, and update to match SUS. Leave the prototype in string.h for now, for backwards compat. PR: 74751 Submitted by: Craig Rodrigues <rodrigc@crodrigues.org> Discussed with: das
* Mark functions pure where applicable. A notable exclusion is strcoll(),tjr2004-07-231-13/+13
| | | | which is not strictly pure because it calls malloc()/free() in some cases.
* Change the definition of NULL on ia64 (for LP64 compilations) frommarcel2003-12-071-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | an int constant to a long constant. This change improves consistency in the following two ways: 1. The first 8 arguments are always passed in registers on ia64, which by virtue of the generated code implicitly widens ints to longs and allows the use of an 32-bit integral type for 64-bit arguments. Subsequent arguments are passed onto the memory stack, which does not exhibit the same behaviour and consequently do not allow this. In practice this means that variadic functions taking pointers and given NULL (without cast) work as long as the NULL is passed in one of the first 8 arguments. A SIGSEGV is more likely the result if such would be done for stack-based arguments. This is due to the fact that the upper 4 bytes remain undefined. 2. All 64-bit platforms that FreeBSD supports, with the obvious exception of ia64, allow 32-bit integral types (specifically NULL) when 64-bit pointers are expected in variadic functions by way of how the compiler generates code. As such, code that works correctly (whether rightfully so or not) on any platform other than ia64, may fail on ia64. To more easily allow tweaking of the definition of NULL, this commit removes the 12 definitions in the various headers and puts it in a new header that can be included whenever NULL is to be made visible. This commit fixes GNOME, emacs, xemacs and a whole bunch of ports that I don't particularly care about at this time...
* Correct visibility conditionals for memccpy(), strdup(), andmike2002-10-141-18/+29
| | | | strtok_r(). Merge conditional prototypes into the regular block.
* Make stpcpy() only visiable w/in __BSD_VISIBLE.obrien2002-10-051-1/+1
|
* Add stpcpy(3).obrien2002-10-031-0/+1
|
* o Merge <machine/ansi.h> and <machine/types.h> into a new headermike2002-08-211-4/+4
| | | | | | | | | | | | | | | | | | | | | called <machine/_types.h>. o <machine/ansi.h> will continue to live so it can define MD clock macros, which are only MD because of gratuitous differences between architectures. o Change all headers to make use of this. This mainly involves changing: #ifdef _BSD_FOO_T_ typedef _BSD_FOO_T_ foo_t; #undef _BSD_FOO_T_ #endif to: #ifndef _FOO_T_DECLARED typedef __foo_t foo_t; #define _FOO_T_DECLARED #endif Concept by: bde Reviewed by: jake, obrien
* Add support for X/Open.mike2002-04-151-2/+5
| | | | PR: 37078
* o Move some function prototypes from <string.h> to the newly rewrittenmike2002-04-041-22/+24
| | | | | | | <strings.h>, based on POSIX.1-2001's requirements. o Add 'restrict' qualifier (spelled '__restrict') to functions in <string.h>, as per C99 and POSIX.1-2001. o Properly expose new POSIX.1-2001 functions in <string.h>.
* Breath deep and take __P out of the system include files.imp2002-03-231-42/+42
| | | | | | # This appears to not break X11, but I'm having problems compiling the # glide part of the server with or without this patch, so I can't tell # for sure.
* Fixed namespace pollution in previous commit. The C99 functionbde2001-11-281-1/+1
| | | | | sterror_r() must not be declared in the C90/POSIX.1-1990 section. Put it in the nonstandard section for now.
* Add strerror_r function per Posix prototype.wes2001-11-271-0/+1
| | | | | Reviewed by: Mike Barcroft <mike@FreeBSD.org> MFC after: 2 weeks
* Fixed some style bugs:bde2001-10-101-3/+3
| | | | | | - rev.1.6: corrupt tab before strlcpy. - rev.1.7: "From: " in vendor id. - rev.1.8: unsorted prototype for strccasestr.
* Implement strcasestr() which many others (f.e. Linux) already haveache2001-10-101-0/+1
|
* Add a new libc function, strnstr(3), which allows one to limit themike2001-10-091-1/+3
| | | | | | | | number of characters that are searched. This is especially useful with file operations and non-NUL terminated strings. Silence from: -audit, -hackers MFC after: 5 days
* Add prototypes for strl* functionsimp1999-08-161-0/+2
| | | | | Forgotten by: imp Reported by: bde
* Add a strsignal(3) (like strerror(3)) for libc compatability with otherpeter1999-05-181-0/+1
| | | | systems. NetBSD, Linux, SVR4 etc all have it.
* Add a prototype for strtok_r().jdp1999-01-201-0/+1
|
* string.h defines nonstandard routines when _POSIX_SOURCE isimp1996-12-171-1/+1
| | | | | | | defined. It has been fixed to not do that. Submitted by: Jake Hamby <jehamby@lightside.com> Closes PR: 1954
* Remove trailing whitespace.rgrimes1995-05-301-1/+1
|
* BSD 4.4 Lite Include Sourcesrgrimes1994-05-241-0/+93
OpenPOWER on IntegriCloud