summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/string.h
Commit message (Collapse)AuthorAgeFilesLines
* Feature test macros overhaul: string.h and strings.h overlapsYaakov Selkowitz2016-04-131-7/+7
| | | | | | | | | | | strings.h is the header mandated for these functions in POSIX.1 prior to 2008 (when most of these were removed). The declarations in string.h are only for BSD compatibility. But when both headers are included, avoid duplicate declarations. Also, mark stpcpy and stpncpy as POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Add timingsafe_memcmp()Sebastian Huber2016-03-181-0/+1
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (timingsafe_memcmp): Declare. * libc/string/timingsafe_memcmp.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Add timingsafe_bcmp()Sebastian Huber2016-03-181-0/+1
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (timingsafe_bcmp): Declare. * libc/string/timingsafe_bcmp.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Add explicit_bzero()Sebastian Huber2016-03-181-0/+3
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (explicit_bzero): Declare. * libc/string/explicit_bzero.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Feature test macros overhaul: string.hYaakov Selkowitz2016-03-171-23/+15
| | | | | | | | | | | | | | Throughout, remove __STRICT_ANSI__ and use the proper internal macros. bcmp, bcopy, bzero, index, and rindex were in POSIX prior to 2008. memrchr is GNU. strdup and strndup are POSIX.1-2008. The int-returning form of strerror_r is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Rework handling of basename variantsYaakov Selkowitz2015-07-061-2/+2
| | | | | | | | | | | | | | | | As a commonly-included header, the #define basename in <string.h> can affect code which uses "basename" for its own purposes (e.g. struct members or C++ namespaced functions). When such cases occur and some code includes <string.h> and some not, then errors result. OTOH, <libgen.h> is rarely used, and that's where the renaming occurs in glibc, so code using <libgen.h> should already be safe. * libc/include/libgen.h (basename): Define as __xpg_basename for source compatibility with glibc. Declare with __ASMNAME("basename") for ABI compatibility. * libc/include/string.h (basename): Define as basename for source compatibility with glibc. Declare with __ASMNAME("__gnu_basename") for ABI compatibility.
* Fix basename prototype collision string.h vs libgen.hCorinna Vinschen2015-04-231-11/+13
| | | | | | | | | | * libc/include/libgen.h (basename): Drop defining _BASENAME_DEFINED. Always define macro basename. Add comment to explain why. * libc/include/string.h (basename): Check for basename instead of _BASENAME_DEFINED. Drop __GNUC__ branch, always use basename macro. Change comment to explain why. Add nonnull function attribute. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* string: add GNU basename(3)Yaakov Selkowitz2015-04-231-0/+14
| | | | | | | | * libc/include/libgen.h (_BASENAME_DEFINED): Define. * libc/include/string.h (basename): Declare. * libc/string/Makefile.am (ELIX_4_SOURCES): Add gnu_basename.c. * libc/string/Makefile.in: Regenerate. * libc/string/gnu_basename.c: New file.
* * libc/include/complex.h (cabsl): Add prototype.Nick Clifton2015-02-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cimagl): Add prototype. (creall): Add prototype. * libc/include/ieeefp.h: Include float.h. (EXT_EXPBITS, EXT_FRACHBITS, EXT_FRACLBITS) (EXT_EXP_INFNAN. EXT_EXP_BIAS, EXT_FRACBITS): Define. (struct ieee_ext, union ieee_ext_u): New types for long double support. * libc/include/math.h (finitel): Add prototype. (hypotl): Add prototype. (sqrtl): Add prototype. * libm/common/Makefile.am (lsrc): Add sl_finite.c. * libm/common/Makefile.in: Regenerate. * libm/common/fdlibm.h (__ieee754_hypotl): Add prototype. * libm/common/hypotl.c (hypotl): Add implementation for when long double is larger than double. * libm/common/sqrtl.c (sqrtl): Likewise. * libm/common/sl_finite.c: New file. Adds implementation of the finitel function. * libm/complex/Makefile.am (lsrc): Define. (libcomplex_la_SOURCES): Add lsrc. (lib_a_SOURCES): Add lsrc. * libm/complex/Makefile.in: Regenerate. * libm/complex/cabs.c: Add documentation of cabsl function. * libm/complex/cimag.c: Add documentation of cimagl function. * libm/complex/creall.c: Add documentation of creall function. * libm/complex/cabsl.c: New file. Adds implementation of the cabsl function. * libm/complex/cimagl.c: New file. Adds implementation of the cimagl function. * libm/complex/creall.c: New file. Adds implementation of the creall function. * libm/math/Makefile.am (lsrc): Define. (libmath_la_SOURCES): Add lsrc. (lib_a_SOURCES): Add lsrc. * libm/math/Makefile.in: Regenerate. * libm/math/el_hypot.c: New file. Adds implementation of the __ieee754_hypotl function.
* 2014-10-29 Jon Turney <jon.turney@dronecode.org.uk>Jon TURNEY2014-10-301-1/+1
| | | | * libc/include/string.h: Correct guard for strcasecmp().
* * libc/include/string.h (ffsl): Declare as GNU function.Corinna Vinschen2014-10-081-0/+5
| | | | (ffsll): Ditto.
* 2014-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>Jeff Johnston2014-09-161-1/+2
| | | | | | Thomas Uhle <thomas.uhle@eas.iis.fraunhofer.de> * libc/include/string.h: Correct guard for strnlen().
* 2014-08-18 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill2014-08-181-34/+51
| | | | * libc/include/string.h: Improve language and OS standard guards.
* * libc/sys/linux/include/netdb.h, libc/sys/linux/net/getaddrinfo.c,Corinna Vinschen2013-07-231-11/+11
| | | | | | | | | | | | | libc/sys/linux/net/getnameinfo.c: Add restrict keyword to getnameinfo() and getaddrinfo() to increase standards compliance and match glibc. * libc/include/string.h, libc/string/memccpy.c, libc/string/memcpy.c, libc/string/stpcpy.c, libc/string/stpncpy.c, libc/string/strcat.c, libc/string/strncat.c, libc/string/strncpy.c, libc/string/strtok.c, libc/string/strtok_r.c, libc/string/strxfrm.c libc/machine/microblaze/strcpy.c, libc/machine/xscale/memcpy.c, libc/machine/cris/memcpy.c: Add __restrict to prototype to increase standards compliance.
* * libc/include/string.h (rawmemchr): Declare.Yaakov Selkowitz2013-06-241-0/+1
| | | | | | | * libc/string/Makefile.am (ELIX_4_SOURCES): Add rawmemchr.c. (CHEWOUT_FILES): Add rawmemchr.def. * libc/string/Makefile.in: Regenerate. * libc/string/rawmemchr.c: New file.
* * libc/include/string.h: Fix preprocessor expressions usingCorinna Vinschen2013-01-121-2/+2
| | | | _XOPEN_SOURCE.
* * libc/include/locale.h (NULL): Fetch definition via stddef.h.Corinna Vinschen2012-11-011-4/+1
| | | | | | | | | * libc/include/stdio.h (NULL): Ditto. * libc/include/stdlib.h (NULL): Ditto. * libc/include/string.h (NULL): Ditto. * libc/include/wchar.h (NULL): Ditto. * libc/include/rpc/types.h (NULL): Ditto. * libc/include/time.h (NULL): Ditto. Include stddef.h earlier.
* * libc/include/string.h (strdup, strndup): Declare if notCorinna Vinschen2012-10-221-0/+9
| | | | __STRICT_ANSI__ or _XOPEN_SOURCE is defined appropriately.
* * libc/include/string.h (memrchr): Declare.Corinna Vinschen2012-05-101-0/+1
| | | | | | | * libc/string/Makefile.am (ELIX_4_SOURCES): Add memrchr.c. (CHEWOUT_FILES): Add memrchr.def. * libc/string/Makefile.in: Regenerate. * libc/string/memrchr.c: New file.
* 2011-06-09 Yaakov Selkowitz <yselkowitz@...>Jeff Johnston2011-06-101-0/+14
| | | | | * libc/include/string.h (strdupa): New macro function. (strndupa): New macro function.
* strerror: allow user hook to comply with POSIX rulesEric Blake2011-05-251-0/+3
| | | | | | | | | | | * libc/string/strerror.c (strerror): Split body into... (_strerror_r): ...new reentrant function. * libc/string/u_strerr.c (_user_strerror): Update signature. * libc/include/stdio.h (_strerror_r): New prototype. * libc/posix/collate.c (__collate_err): Adjust callers. * libc/stdio/perror.c (_perror_r): Likewise. * libc/string/strerror_r.c (strerror_r): Likewise. * libc/string/xpg_strerror_r.c (__xpg_strerror_r): Likewise.
* * libc/include/string.h (strchrnul): Declare.Corinna Vinschen2011-03-281-0/+1
| | | | | | * libc/string/strchrnul.c: New file. * libc/string/Makefile.am (ELIX_2_SOURCES): Add strchrnul.c. * libc/string/Makefile.in: Regenerate.
* * libc/include/string.h: Include sys/cdefs.h.Corinna Vinschen2011-03-031-0/+1
|
* * libc/include/sys/cdefs.h (__CONCAT1): Define.Corinna Vinschen2011-03-031-1/+1
| | | | | | | | | (__CONCAT): Define. (__STRING): Define. (__XSTRING): Define. (__ASMNAME): Define. * libc/include/string.h (strerror_r): Use __ASMNAME to take target specific label prefixes into account.
* strerror_r: provide POSIX implementationEric Blake2011-02-101-1/+14
| | | | | | | | | | | * libc/include/string.h (strerror_r): Update declaration. * libc/string/strerror.c (strerror): Update documentation. * libc/string/strerror_r.c (strerror_r): Always return NUL-terminated string; don't overwrite too-short buf. * libc/string/xpg_strerror_r.c (__xpg_strerror_r): Implement POSIX variant. * libc/string/Makefile.am (GENERAL_SOURCES): Build new file. * libc/string/Makefile.in: Regenerate.
* * libc/include/string.h: Make strsignal() available unconditionally.Corinna Vinschen2011-01-101-1/+1
|
* Per Posix, strsignal returns non-const char*.Eric Blake2008-06-181-1/+1
| | | | * libc/include/string.h (strsignal): Fix return type.
* Make strstr and strcasestr O(n), not O(n^2); add memmem.Eric Blake2008-01-121-3/+1
| | | | | | | | | | | | | | | * libc/string/str-two-way.h: New file. * libc/string/memmem.c (memmem): New file. * libc/include/string.h (memmem): Declare for all platforms. * libc/string/strstr.c (strstr): Provide O(n) implementation when not optimizing for space. * libc/string/strcasestr.c (strcasestr): Likewise. * libc/string/Makefile.am (ELIX_SOURCES): Rename to... (ELIX_2_SOURCES): ...this. (ELIX_4_SOURCES): New category, for memmem. (lib_a_SOURCES, libstring_la_SOURCES): Build new file. (CHEWOUT_FILES): Build documentation for memmem. * libc/string/strings.tex: Include new docs.
* * libc/include/string.h: Add prototypes for stpcpy and stpncpy.Corinna Vinschen2007-06-281-0/+2
| | | | | | | | | | * libc/string/Makefile.am (ELIX_SOURCES): Add stpcpy.c and stpncpy.c. (CHEWOUT_FILES): Add stpcpy.def and stpncpy.def. * libc/string/Makefile.in: Regenerate. * libc/string/stpcpy.c: New file. * libc/string/stpncpy.c: New file. * libc/string/strings.tex: Add stpcpy and stpncpy.
* 2007-06-08 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2007-06-081-0/+1
| | | | | | | | * libc/string/strcasestr.c: New file. * libc/include/string.h: Add strcasestr. * libc/string/strings.tex: Add strcasestr. * libc/string/Makefile.am: Ditto. * libc/string/Makefile.in: Regenerated.
* * libc/include/string.h: Add cygwin-specific function declaration.Christopher Faylor2005-11-081-0/+3
|
* * libc/include/string.h: Revert previous change.Christopher Faylor2005-08-261-4/+0
|
* * libc/include/string.h: For Cygwin, Define strerror_r as per ISO C.Christopher Faylor2005-08-251-0/+4
|
* 2005-01-24 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2005-01-241-2/+2
| | | | | | | | * libc/include/string.h: Remove Linux-specific declaration of strsignal and add #include <sys/string.h>. * libc/include/sys/string.h: New file. * libc/include/sys/linux/sys/string.h: New file with strsignal declaration deleted above.
* 2002-07-23 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2002-07-231-0/+3
| | | | | | | | | | | | | | | | | | | * libc/include/string.h: Add mempcpy, strndup, and _strndup_r prototypes. * libc/stdlib/Makefile.am: Remove strdup.c and strdup_r.c. * libc/stdlib/Makefile.in: Regenerated. * libc/stdlib/strdup.c: Removed. * libc/stdlib/strdup_r.c: Removed. * libc/string/Makefile.am: Add strdup.c, strdup_r.c, memccpy.c, mempcpy.c, strndup.c, and strndup_r.c. * libc/string/Makefile.in: Regenerated. * libc/string/memccpy.c: New file. * libc/string/mempcpy.c: Ditto. * libc/string/strndup.c: Ditto. * libc/string/strndup_r.c: Ditto. * libc/string/strdup.c: New file moved from stdlib. * libc/string/strdup_r.c: Ditto. * libc/string/strings.tex: Add memccpy and mempcpy documentation.
* 2002-06-27 Benjamin Kosnik <bkoz@redhat.com>Jeff Johnston2002-06-271-7/+4
| | | | | | | | | | | | | | | * libc/include/stdio.h: Untangle, add _BEGIN_STD_C and _END_STD_C. * libc/include/time.h: Same. * libc/include/string.h: Same. * libc/include/stdlib.h: Same. * libc/include/signal.h: Same. * libc/include/setjmp.h: Same. * libc/include/math.h: Same. * libc/include/locale.h: Same. * libc/include/ctype.h: Same. * libc/include/machine/setjmp.h: Same. * libc/include/_ansi.h (_BEGIN_STD_C): Add. (_END_STD_C): Add.
* 2002-06-05 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2002-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * libc/include/string.h[__linux__]: Add strsignal prototype. * libc/include/sys/lock.h: New file with default locking support. * libc/include/sys/reent.h: Add signal buffer support for strsignal and psignal. * libc/posix/Makefile.am: Add support for readdir_r.c. * libc/posix/Makefile.in: Regenerated. * libc/posix/closedir.c: Add locking support and hash table cleanup. * libc/posix/opendir.c: Add lock support. * libc/posix/readdir.c: Ditto. * libc/posix/rewinddir.c: Ditto. * libc/posix/scandir.c: Ditto. * libc/posix/seekdir.c: Ditto. * libc/posix/telldir.c: Ditto plus add _cleanupdir routine to clean up leftover hash table entries. * libc/posix/readdir_r.c: New file. * libc/sys/linux/Makefile.am: Add psignal.c and strsignal.c support. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/sys/dirent.h: Add dd_lock to DIR structure. * libc/sys/linux/sys/signal.h: Add psignal prototype. * libc/sys/linux/psignal.c: New file. * libc/sys/linux/strsignal.c: Ditto.
* 2002-05-24 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2002-05-241-0/+2
| | | | | | | | | | | * libc/include/string.h: Add strnlen and strerror_r prototypes. * libc/string/Makefile.am: Add strnlen.c and strerror_r.c support. * libc/string/Makefile.in: Regenerated. * libc/string/strerror_r.c: New file. * libc/string/strnlen.c: New file. * libc/sys/linux/Makefile.am: Add rename.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/rename.c: New file to override default rename.
* 2002-05-23 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston2002-05-231-3/+3
| | | | | | | | * libc/include/string.h (bcmp, bcopy, bzero): Change prototypes to use void * pointers and comply with Single Unix spec. * libc/string/bcmp.c: Change to use void * instead of char *. * libc/string/bcopy.c: Ditto. * libc/string/bzero.c: Ditto.
* 2002-05-10 Mark Bradshaw <bradshaw@staff.crosswalk.com>Thomas Fitzsimmons2002-05-131-0/+2
| | | | | | | * libc/include/string.h (!__STRICT_ANSI__): Add strlcat and strlcpy. * libc/string/Makefile.am: Add strlcat.c and strlcpy.c. * libc/string/strlcat.c: New file. * libc/string/strlcpy.c: New file.
* * libc/string/swab.c: Specify that it's defined in <unistd.h>.Geoffrey Keating2000-08-301-2/+0
| | | | | | * libc/include/string.h: Don't include <sys/types.h>, as it causes really bad namespace pollution. Don't declare swab(), it is properly declared in unistd.h.
* * libc/include/string.h: Work around problem with strsignal and gdb.Christopher Faylor2000-06-031-0/+2
|
* * libc/include/ctype.h: __CYGWIN32__ -> __CYGWIN__Christopher Faylor2000-05-301-2/+2
| | | | | | | | | | | | | | | * libc/include/malloc.h: Ditto. * libc/include/process.h: Ditto. * libc/include/stdio.h: Ditto. * libc/include/stdlib.h: Ditto. * libc/include/time.h: Ditto. * libc/include/machine/setjmp.h: Ditto. * libc/include/sys/errno.h: Ditto. * libc/include/sys/signal.h: Ditto. * libc/include/sys/stat.h: Ditto. * libc/include/sys/time.h: Ditto. * libc/include/sys/unistd.h: Ditto. * libc/include/string.h: Ditto. strsignal should return a const char *.
* Fri Mar 10 16:09:20 2000 Jeff Johnston <jjohnstn@cygnus.com>Jeff Johnston2000-03-101-0/+1
| | | | * libc/include/string.h: Include <sys/types.h>.
* Thu Mar 9 17:20:41 2000 Jeff Johnston <jjohnstn@cygnus.com>Jeff Johnston2000-03-091-1/+1
| | | | | | | | * libc/include/string.h: Changed last argument back to ssize_t to make it compatible with XPG4 definition which is defined in <unistd.h>. There is a conflict in the SVID 3 and XPG4 definitions and newlib will settle with XPG4. * libc/string/swab.c: Ditto.
* Wed Mar 8 17:11:41 2000 Jeff Johnston <jjohnstn@cygnus.com>Jeff Johnston2000-03-081-1/+1
| | | | | * libc/include/string.h: Changed last argument to size_t. * libc/string/swab.c: Changed last argument to size_t.
* * libc/string/Makefile.am (lib_a_SOURCES): Added swab.c.Alexandre Oliva2000-03-081-0/+1
| | | | | | | | (CHEWOUT_FILES): Added swab.def. * libc/string/Makefile.in: Rebuilt. * libc/string/string.tex: Include swab.def. * libc/include/string.h (swab): Declare. * libc/string/swab.c: New file.
* import newlib-2000-02-17 snapshotChristopher Faylor2000-02-171-0/+92