mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
Declare memccpy, strdup, strndup for C2X.
C2X adds the memccpy, strdup and strndup functions. This patch duly adds __GLIBC_USE (ISOC2X) to the conditions under which <string.h> declares them. Tested for x86_64. * string/string.h (memccpy): Also declare if [__GLIBC_USE (ISOC2X)]. (strdup): Likewise. (strndup): Likewise.
This commit is contained in:
parent
777d75fbc0
commit
a8c2fa984a
2 changed files with 7 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
||||||
2019-08-13 Joseph Myers <joseph@codesourcery.com>
|
2019-08-13 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* string/string.h (memccpy): Also declare if [__GLIBC_USE (ISOC2X)].
|
||||||
|
(strdup): Likewise.
|
||||||
|
(strndup): Likewise.
|
||||||
|
|
||||||
* include/features.h (_ISOC2X_SOURCE): New feature test macro.
|
* include/features.h (_ISOC2X_SOURCE): New feature test macro.
|
||||||
Undefine and define to 1 if [_GNU_SOURCE].
|
Undefine and define to 1 if [_GNU_SOURCE].
|
||||||
(__GLIBC_USE_ISOC2X): New macro. Undefine and redefine depending
|
(__GLIBC_USE_ISOC2X): New macro. Undefine and redefine depending
|
||||||
|
|
|
@ -49,7 +49,7 @@ extern void *memmove (void *__dest, const void *__src, size_t __n)
|
||||||
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
|
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
|
||||||
Return the position in DEST one byte past where C was copied,
|
Return the position in DEST one byte past where C was copied,
|
||||||
or NULL if C was not found in the first N bytes of SRC. */
|
or NULL if C was not found in the first N bytes of SRC. */
|
||||||
#if defined __USE_MISC || defined __USE_XOPEN
|
#if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISOC2X)
|
||||||
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
|
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
|
||||||
int __c, size_t __n)
|
int __c, size_t __n)
|
||||||
__THROW __nonnull ((1, 2));
|
__THROW __nonnull ((1, 2));
|
||||||
|
@ -161,7 +161,7 @@ extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 \
|
#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 \
|
||||||
|| __GLIBC_USE (LIB_EXT2))
|
|| __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X))
|
||||||
/* Duplicate S, returning an identical malloc'd string. */
|
/* Duplicate S, returning an identical malloc'd string. */
|
||||||
extern char *strdup (const char *__s)
|
extern char *strdup (const char *__s)
|
||||||
__THROW __attribute_malloc__ __nonnull ((1));
|
__THROW __attribute_malloc__ __nonnull ((1));
|
||||||
|
@ -170,7 +170,7 @@ extern char *strdup (const char *__s)
|
||||||
/* Return a malloc'd copy of at most N bytes of STRING. The
|
/* Return a malloc'd copy of at most N bytes of STRING. The
|
||||||
resultant string is terminated even if no null terminator
|
resultant string is terminated even if no null terminator
|
||||||
appears before STRING[N]. */
|
appears before STRING[N]. */
|
||||||
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
|
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)
|
||||||
extern char *strndup (const char *__string, size_t __n)
|
extern char *strndup (const char *__string, size_t __n)
|
||||||
__THROW __attribute_malloc__ __nonnull ((1));
|
__THROW __attribute_malloc__ __nonnull ((1));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue