• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef	_STRING_H
2 #define	_STRING_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <features.h>
9 
10 #if __cplusplus >= 201103L
11 #define NULL nullptr
12 #elif defined(__cplusplus)
13 #define NULL 0L
14 #else
15 #define NULL ((void*)0)
16 #endif
17 
18 #define __NEED_size_t
19 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
20  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
21  || defined(_BSD_SOURCE)
22 #define __NEED_locale_t
23 #endif
24 
25 #include <bits/alltypes.h>
26 
27 void *memcpy (void *__restrict, const void *__restrict, size_t);
28 void *memmove (void *, const void *, size_t);
29 void *memset (void *, int, size_t);
30 int memcmp (const void *, const void *, size_t);
31 void *memchr (const void *, int, size_t);
32 
33 char *strcpy (char *__restrict, const char *__restrict);
34 char *strncpy (char *__restrict, const char *__restrict, size_t);
35 
36 char *strcat (char *__restrict, const char *__restrict);
37 char *strncat (char *__restrict, const char *__restrict, size_t);
38 
39 int strcmp (const char *, const char *);
40 int strncmp (const char *, const char *, size_t);
41 
42 int strcoll (const char *, const char *);
43 size_t strxfrm (char *__restrict, const char *__restrict, size_t);
44 
45 char *strchr (const char *, int);
46 char *strrchr (const char *, int);
47 
48 size_t strcspn (const char *, const char *);
49 size_t strspn (const char *, const char *);
50 char *strpbrk (const char *, const char *);
51 char *strstr (const char *, const char *);
52 char *strtok (char *__restrict, const char *__restrict);
53 
54 size_t strlen (const char *);
55 
56 char *strerror (int);
57 
58 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
59 #include <strings.h>
60 #endif
61 
62 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
63  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
64  || defined(_BSD_SOURCE)
65 char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
66 int strerror_r (int, char *, size_t);
67 char *stpcpy(char *__restrict, const char *__restrict);
68 char *stpncpy(char *__restrict, const char *__restrict, size_t);
69 size_t strnlen (const char *, size_t);
70 char *strdup (const char *);
71 char *strndup (const char *, size_t);
72 char *strsignal(int);
73 char *strerror_l (int, locale_t);
74 int strcoll_l (const char *, const char *, locale_t);
75 size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
76 #endif
77 
78 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
79  || defined(_BSD_SOURCE)
80 void *memccpy (void *__restrict, const void *__restrict, int, size_t);
81 #endif
82 
83 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
84 char *strsep(char **, const char *);
85 size_t strlcat (char *, const char *, size_t);
86 size_t strlcpy (char *, const char *, size_t);
87 void explicit_bzero (void *, size_t);
88 #endif
89 
90 #ifdef _GNU_SOURCE
91 #define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
92 int strverscmp (const char *, const char *);
93 char *strchrnul(const char *, int);
94 char *strcasestr(const char *, const char *);
95 void *memmem(const void *, size_t, const void *, size_t);
96 void *memrchr(const void *, int, size_t);
97 void *mempcpy(void *, const void *, size_t);
98 #ifndef __cplusplus
99 char *basename(const char *);
100 #endif
101 #endif
102 
103 #ifdef LOSCFG_KERNEL_LMS
104 void *__memset (void *, int, size_t);
105 void *__memcpy (void *__restrict, const void *__restrict, size_t);
106 void *__memmove (void *, const void *, size_t);
107 char *__strcat (char *__restrict, const char *__restrict);
108 char *__strncat (char *__restrict, const char *__restrict, size_t);
109 char *__strcpy (char *__restrict, const char *__restrict);
110 char *__strncpy (char *__restrict, const char *__restrict, size_t);
111 
112 #if defined(__has_feature) /* clang */
113 
114 #if !__has_feature(address_sanitizer)
115 #define memset(s, c, n) __memset(s, c, n)
116 #define memcpy(dst, src, len) __memcpy(dst, src, len)
117 #define memmove(dst, src, len) __memmove(dst, src, len)
118 #define strcat(dst, src) __strcat(dst, src)
119 #define strcpy(dst, src) __strcpy(dst, src)
120 #define strncat(dst, src, n) __strncat(dst, src, n)
121 #define strncpy(dst, src, n) __strncpy(dst, src, n)
122 #endif
123 
124 #else /* gcc */
125 #if !defined(__SANITIZE_ADDRESS__)
126 #define memset(s, c, n) __memset(s, c, n)
127 #define memcpy(dst, src, len) __memcpy(dst, src, len)
128 #define memmove(dst, src, len) __memmove(dst, src, len)
129 #define strcat(dst, src) __strcat(dst, src)
130 #define strcpy(dst, src) __strcpy(dst, src)
131 #define strncat(dst, src, n) __strncat(dst, src, n)
132 #define strncpy(dst, src, n) __strncpy(dst, src, n)
133 #endif
134 #endif /* __has_feature */
135 
136 #endif /* LOSCFG_KERNEL_LMS */
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif
143