Files
glibc/include/string.h
T

189 lines
6.1 KiB
C
Raw Normal View History

1998-09-06 23:45:24 +00:00
#ifndef _STRING_H
1999-11-24 20:48:27 +00:00
#ifndef _ISOMAC
1999-11-24 20:48:27 +00:00
#include <sys/types.h>
2012-01-07 23:57:22 -05:00
extern void *__memccpy (void *__dest, const void *__src,
2004-10-18 04:17:19 +00:00
int __c, size_t __n);
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern size_t __strnlen (const char *__string, size_t __maxlen)
2000-05-12 07:01:25 +00:00
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern char *__strsep (char **__stringp, const char *__delim);
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern int __strverscmp (const char *__s1, const char *__s2)
2000-05-12 07:01:25 +00:00
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern int __strncasecmp (const char *__s1, const char *__s2,
2000-05-12 07:01:25 +00:00
size_t __n)
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern int __strcasecmp (const char *__s1, const char *__s2)
2000-10-20 06:16:38 +00:00
__attribute_pure__;
2012-01-07 23:57:22 -05:00
extern char *__strcasestr (const char *__haystack, const char *__needle)
2000-10-20 06:16:38 +00:00
__attribute_pure__;
2012-01-07 23:57:22 -05:00
extern char *__strdup (const char *__string)
2000-06-23 02:04:57 +00:00
__attribute_malloc__;
2012-01-07 23:57:22 -05:00
extern char *__strndup (const char *__string, size_t __n)
1999-12-19 19:14:15 +00:00
__attribute_malloc__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern void *__rawmemchr (const void *__s, int __c)
2000-05-12 07:01:25 +00:00
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern char *__strchrnul (const char *__s, int __c)
2000-05-12 07:01:25 +00:00
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern void *__memrchr (const void *__s, int __c, size_t __n)
2000-05-12 07:01:25 +00:00
__attribute_pure__;
1999-11-24 20:48:27 +00:00
2012-01-07 23:57:22 -05:00
extern void *__memchr (const void *__s, int __c, size_t __n)
2000-07-18 14:00:31 +00:00
__attribute_pure__;
2001-02-06 18:27:57 +00:00
extern int __ffs (int __i) __attribute__ ((const));
extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
#endif
2001-02-06 18:27:57 +00:00
/* Get _STRING_ARCH_unaligned. */
#include <string_private.h>
1999-11-24 20:48:27 +00:00
/* Now the real definitions. We do this here since some of the functions
above are defined as macros in the headers. */
1995-02-18 01:27:10 +00:00
#include <string/string.h>
2001-08-30 23:22:02 +00:00
#ifndef _ISOMAC
extern __typeof (strcoll_l) __strcoll_l;
extern __typeof (strxfrm_l) __strxfrm_l;
extern __typeof (strcasecmp_l) __strcasecmp_l;
extern __typeof (strncasecmp_l) __strncasecmp_l;
2001-08-30 23:22:02 +00:00
/* Alternative version which doesn't pollute glibc's namespace. */
2014-11-24 15:03:45 +05:30
#if IS_IN (libc)
# undef strndupa
# define strndupa(s, n) \
2001-08-30 23:22:02 +00:00
(__extension__ \
({ \
2012-01-07 23:57:22 -05:00
const char *__old = (s); \
2001-08-30 23:22:02 +00:00
size_t __len = __strnlen (__old, (n)); \
char *__new = (char *) __builtin_alloca (__len + 1); \
__new[__len] = '\0'; \
(char *) memcpy (__new, __old, __len); \
}))
#endif
2002-08-03 07:02:10 +00:00
libc_hidden_proto (__mempcpy)
2002-08-04 01:22:11 +00:00
libc_hidden_proto (__stpcpy)
2002-08-03 07:02:10 +00:00
libc_hidden_proto (__stpncpy)
libc_hidden_proto (__rawmemchr)
libc_hidden_proto (__strcasecmp)
2002-08-03 21:19:56 +00:00
libc_hidden_proto (__strcasecmp_l)
libc_hidden_proto (__strncasecmp_l)
libc_hidden_proto (__strdup)
libc_hidden_proto (__strndup)
libc_hidden_proto (__strerror_r)
2002-08-04 09:27:27 +00:00
libc_hidden_proto (__strverscmp)
libc_hidden_proto (basename)
extern char *__basename (const char *__filename) __THROW __nonnull ((1));
libc_hidden_proto (__basename)
libc_hidden_proto (strcoll)
2004-03-14 21:12:06 +00:00
libc_hidden_proto (__strcoll_l)
libc_hidden_proto (__strxfrm_l)
2004-07-10 20:00:44 +00:00
libc_hidden_proto (__strtok_r)
2012-01-07 23:57:22 -05:00
extern char *__strsep_g (char **__stringp, const char *__delim);
2004-07-10 20:00:44 +00:00
libc_hidden_proto (__strsep_g)
2005-10-24 19:31:12 +00:00
libc_hidden_proto (strnlen)
libc_hidden_proto (__strnlen)
libc_hidden_proto (memmem)
2014-11-12 22:41:03 +00:00
extern __typeof (memmem) __memmem;
libc_hidden_proto (__memmem)
2013-09-20 21:24:53 +02:00
libc_hidden_proto (__ffs)
2003-04-29 22:49:58 +00:00
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
2004-05-26 17:27:20 +00:00
libc_hidden_builtin_proto (mempcpy)
2004-04-01 23:29:52 +00:00
libc_hidden_builtin_proto (memcmp)
2003-04-29 22:49:58 +00:00
libc_hidden_builtin_proto (memmove)
libc_hidden_builtin_proto (memset)
libc_hidden_builtin_proto (strcat)
libc_hidden_builtin_proto (strchr)
libc_hidden_builtin_proto (strcmp)
libc_hidden_builtin_proto (strcpy)
libc_hidden_builtin_proto (strcspn)
libc_hidden_builtin_proto (strlen)
libc_hidden_builtin_proto (strncmp)
libc_hidden_builtin_proto (strncpy)
libc_hidden_builtin_proto (strpbrk)
2004-05-26 17:27:20 +00:00
libc_hidden_builtin_proto (stpcpy)
2003-04-29 22:49:58 +00:00
libc_hidden_builtin_proto (strrchr)
libc_hidden_builtin_proto (strspn)
libc_hidden_builtin_proto (strstr)
2004-07-05 17:36:34 +00:00
libc_hidden_builtin_proto (ffs)
2003-04-29 22:49:58 +00:00
2015-10-15 14:25:45 -07:00
#if IS_IN (rtld)
extern __typeof (__stpcpy) __stpcpy attribute_hidden;
extern __typeof (__strdup) __strdup attribute_hidden;
extern __typeof (__strerror_r) __strerror_r attribute_hidden;
extern __typeof (__strsep_g) __strsep_g attribute_hidden;
extern __typeof (memchr) memchr attribute_hidden;
extern __typeof (memcmp) memcmp attribute_hidden;
extern __typeof (memcpy) memcpy attribute_hidden;
extern __typeof (memmove) memmove attribute_hidden;
extern __typeof (memset) memset attribute_hidden;
extern __typeof (rawmemchr) rawmemchr attribute_hidden;
extern __typeof (stpcpy) stpcpy attribute_hidden;
extern __typeof (strchr) strchr attribute_hidden;
extern __typeof (strcmp) strcmp attribute_hidden;
extern __typeof (strlen) strlen attribute_hidden;
extern __typeof (strnlen) strnlen attribute_hidden;
extern __typeof (strsep) strsep attribute_hidden;
#endif
2014-11-24 15:03:45 +05:30
#if (!IS_IN (libc) || !defined SHARED) \
2014-11-14 13:48:39 +00:00
&& !defined NO_MEMPCPY_STPCPY_REDIRECT
2014-11-12 22:36:34 +00:00
/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
__mempcpy and __stpcpy if not inlined. */
extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
#endif
# ifndef _ISOMAC
# ifndef index
# define index(s, c) (strchr ((s), (c)))
# endif
# ifndef rindex
# define rindex(s, c) (strrchr ((s), (c)))
# endif
# endif
2004-10-18 04:17:19 +00:00
extern void *__memcpy_chk (void *__restrict __dest,
const void *__restrict __src, size_t __len,
size_t __destlen) __THROW;
extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
size_t __destlen) __THROW;
extern void *__mempcpy_chk (void *__restrict __dest,
const void *__restrict __src, size_t __len,
size_t __destlen) __THROW;
extern void *__memset_chk (void *__dest, int __ch, size_t __len,
size_t __destlen) __THROW;
extern char *__strcpy_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __destlen) __THROW;
extern char *__stpcpy_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __destlen) __THROW;
extern char *__strncpy_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __len, size_t __destlen) __THROW;
extern char *__strcat_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __destlen) __THROW;
extern char *__strncat_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __len, size_t __destlen) __THROW;
#endif
2004-10-18 04:17:19 +00:00
#endif