.. | .. |
---|
43 | 43 | * |
---|
44 | 44 | * returns the length of @s |
---|
45 | 45 | */ |
---|
| 46 | +#ifdef __HAVE_ARCH_STRLEN |
---|
46 | 47 | size_t strlen(const char *s) |
---|
47 | 48 | { |
---|
48 | 49 | return __strend(s) - s; |
---|
49 | 50 | } |
---|
50 | 51 | EXPORT_SYMBOL(strlen); |
---|
| 52 | +#endif |
---|
51 | 53 | |
---|
52 | 54 | /** |
---|
53 | 55 | * strnlen - Find the length of a length-limited string |
---|
.. | .. |
---|
56 | 58 | * |
---|
57 | 59 | * returns the minimum of the length of @s and @n |
---|
58 | 60 | */ |
---|
| 61 | +#ifdef __HAVE_ARCH_STRNLEN |
---|
59 | 62 | size_t strnlen(const char *s, size_t n) |
---|
60 | 63 | { |
---|
61 | 64 | return __strnend(s, n) - s; |
---|
62 | 65 | } |
---|
63 | 66 | EXPORT_SYMBOL(strnlen); |
---|
| 67 | +#endif |
---|
64 | 68 | |
---|
65 | 69 | /** |
---|
66 | 70 | * strcpy - Copy a %NUL terminated string |
---|
.. | .. |
---|
69 | 73 | * |
---|
70 | 74 | * returns a pointer to @dest |
---|
71 | 75 | */ |
---|
| 76 | +#ifdef __HAVE_ARCH_STRCPY |
---|
72 | 77 | char *strcpy(char *dest, const char *src) |
---|
73 | 78 | { |
---|
74 | 79 | register int r0 asm("0") = 0; |
---|
.. | .. |
---|
81 | 86 | return ret; |
---|
82 | 87 | } |
---|
83 | 88 | EXPORT_SYMBOL(strcpy); |
---|
| 89 | +#endif |
---|
84 | 90 | |
---|
85 | 91 | /** |
---|
86 | 92 | * strlcpy - Copy a %NUL terminated string into a sized buffer |
---|
.. | .. |
---|
93 | 99 | * of course, the buffer size is zero). It does not pad |
---|
94 | 100 | * out the result like strncpy() does. |
---|
95 | 101 | */ |
---|
| 102 | +#ifdef __HAVE_ARCH_STRLCPY |
---|
96 | 103 | size_t strlcpy(char *dest, const char *src, size_t size) |
---|
97 | 104 | { |
---|
98 | 105 | size_t ret = __strend(src) - src; |
---|
.. | .. |
---|
105 | 112 | return ret; |
---|
106 | 113 | } |
---|
107 | 114 | EXPORT_SYMBOL(strlcpy); |
---|
| 115 | +#endif |
---|
108 | 116 | |
---|
109 | 117 | /** |
---|
110 | 118 | * strncpy - Copy a length-limited, %NUL-terminated string |
---|
.. | .. |
---|
115 | 123 | * The result is not %NUL-terminated if the source exceeds |
---|
116 | 124 | * @n bytes. |
---|
117 | 125 | */ |
---|
| 126 | +#ifdef __HAVE_ARCH_STRNCPY |
---|
118 | 127 | char *strncpy(char *dest, const char *src, size_t n) |
---|
119 | 128 | { |
---|
120 | 129 | size_t len = __strnend(src, n) - src; |
---|
.. | .. |
---|
123 | 132 | return dest; |
---|
124 | 133 | } |
---|
125 | 134 | EXPORT_SYMBOL(strncpy); |
---|
| 135 | +#endif |
---|
126 | 136 | |
---|
127 | 137 | /** |
---|
128 | 138 | * strcat - Append one %NUL-terminated string to another |
---|
.. | .. |
---|
131 | 141 | * |
---|
132 | 142 | * returns a pointer to @dest |
---|
133 | 143 | */ |
---|
| 144 | +#ifdef __HAVE_ARCH_STRCAT |
---|
134 | 145 | char *strcat(char *dest, const char *src) |
---|
135 | 146 | { |
---|
136 | 147 | register int r0 asm("0") = 0; |
---|
.. | .. |
---|
146 | 157 | return ret; |
---|
147 | 158 | } |
---|
148 | 159 | EXPORT_SYMBOL(strcat); |
---|
| 160 | +#endif |
---|
149 | 161 | |
---|
150 | 162 | /** |
---|
151 | 163 | * strlcat - Append a length-limited, %NUL-terminated string to another |
---|
.. | .. |
---|
153 | 165 | * @src: The string to append to it |
---|
154 | 166 | * @n: The size of the destination buffer. |
---|
155 | 167 | */ |
---|
| 168 | +#ifdef __HAVE_ARCH_STRLCAT |
---|
156 | 169 | size_t strlcat(char *dest, const char *src, size_t n) |
---|
157 | 170 | { |
---|
158 | 171 | size_t dsize = __strend(dest) - dest; |
---|
.. | .. |
---|
170 | 183 | return res; |
---|
171 | 184 | } |
---|
172 | 185 | EXPORT_SYMBOL(strlcat); |
---|
| 186 | +#endif |
---|
173 | 187 | |
---|
174 | 188 | /** |
---|
175 | 189 | * strncat - Append a length-limited, %NUL-terminated string to another |
---|
.. | .. |
---|
182 | 196 | * Note that in contrast to strncpy, strncat ensures the result is |
---|
183 | 197 | * terminated. |
---|
184 | 198 | */ |
---|
| 199 | +#ifdef __HAVE_ARCH_STRNCAT |
---|
185 | 200 | char *strncat(char *dest, const char *src, size_t n) |
---|
186 | 201 | { |
---|
187 | 202 | size_t len = __strnend(src, n) - src; |
---|
.. | .. |
---|
192 | 207 | return dest; |
---|
193 | 208 | } |
---|
194 | 209 | EXPORT_SYMBOL(strncat); |
---|
| 210 | +#endif |
---|
195 | 211 | |
---|
196 | 212 | /** |
---|
197 | 213 | * strcmp - Compare two strings |
---|
.. | .. |
---|
202 | 218 | * < 0 if @s1 is less than @s2 |
---|
203 | 219 | * > 0 if @s1 is greater than @s2 |
---|
204 | 220 | */ |
---|
| 221 | +#ifdef __HAVE_ARCH_STRCMP |
---|
205 | 222 | int strcmp(const char *s1, const char *s2) |
---|
206 | 223 | { |
---|
207 | 224 | register int r0 asm("0") = 0; |
---|
.. | .. |
---|
219 | 236 | return ret; |
---|
220 | 237 | } |
---|
221 | 238 | EXPORT_SYMBOL(strcmp); |
---|
| 239 | +#endif |
---|
222 | 240 | |
---|
223 | 241 | /** |
---|
224 | 242 | * strrchr - Find the last occurrence of a character in a string |
---|
225 | 243 | * @s: The string to be searched |
---|
226 | 244 | * @c: The character to search for |
---|
227 | 245 | */ |
---|
| 246 | +#ifdef __HAVE_ARCH_STRRCHR |
---|
228 | 247 | char *strrchr(const char *s, int c) |
---|
229 | 248 | { |
---|
230 | 249 | ssize_t len = __strend(s) - s; |
---|
.. | .. |
---|
236 | 255 | return NULL; |
---|
237 | 256 | } |
---|
238 | 257 | EXPORT_SYMBOL(strrchr); |
---|
| 258 | +#endif |
---|
239 | 259 | |
---|
240 | 260 | static inline int clcle(const char *s1, unsigned long l1, |
---|
241 | 261 | const char *s2, unsigned long l2) |
---|
.. | .. |
---|
260 | 280 | * @s1: The string to be searched |
---|
261 | 281 | * @s2: The string to search for |
---|
262 | 282 | */ |
---|
| 283 | +#ifdef __HAVE_ARCH_STRSTR |
---|
263 | 284 | char *strstr(const char *s1, const char *s2) |
---|
264 | 285 | { |
---|
265 | 286 | int l1, l2; |
---|
.. | .. |
---|
279 | 300 | return NULL; |
---|
280 | 301 | } |
---|
281 | 302 | EXPORT_SYMBOL(strstr); |
---|
| 303 | +#endif |
---|
282 | 304 | |
---|
283 | 305 | /** |
---|
284 | 306 | * memchr - Find a character in an area of memory. |
---|
.. | .. |
---|
289 | 311 | * returns the address of the first occurrence of @c, or %NULL |
---|
290 | 312 | * if @c is not found |
---|
291 | 313 | */ |
---|
| 314 | +#ifdef __HAVE_ARCH_MEMCHR |
---|
292 | 315 | void *memchr(const void *s, int c, size_t n) |
---|
293 | 316 | { |
---|
294 | 317 | register int r0 asm("0") = (char) c; |
---|
.. | .. |
---|
303 | 326 | return (void *) ret; |
---|
304 | 327 | } |
---|
305 | 328 | EXPORT_SYMBOL(memchr); |
---|
| 329 | +#endif |
---|
306 | 330 | |
---|
307 | 331 | /** |
---|
308 | 332 | * memcmp - Compare two areas of memory |
---|
309 | 333 | * @s1: One area of memory |
---|
310 | 334 | * @s2: Another area of memory |
---|
311 | | - * @count: The size of the area. |
---|
| 335 | + * @n: The size of the area. |
---|
312 | 336 | */ |
---|
| 337 | +#ifdef __HAVE_ARCH_MEMCMP |
---|
313 | 338 | int memcmp(const void *s1, const void *s2, size_t n) |
---|
314 | 339 | { |
---|
315 | 340 | int ret; |
---|
.. | .. |
---|
320 | 345 | return ret; |
---|
321 | 346 | } |
---|
322 | 347 | EXPORT_SYMBOL(memcmp); |
---|
| 348 | +#endif |
---|
323 | 349 | |
---|
324 | 350 | /** |
---|
325 | 351 | * memscan - Find a character in an area of memory. |
---|
.. | .. |
---|
330 | 356 | * returns the address of the first occurrence of @c, or 1 byte past |
---|
331 | 357 | * the area if @c is not found |
---|
332 | 358 | */ |
---|
| 359 | +#ifdef __HAVE_ARCH_MEMSCAN |
---|
333 | 360 | void *memscan(void *s, int c, size_t n) |
---|
334 | 361 | { |
---|
335 | 362 | register int r0 asm("0") = (char) c; |
---|
.. | .. |
---|
341 | 368 | return (void *) ret; |
---|
342 | 369 | } |
---|
343 | 370 | EXPORT_SYMBOL(memscan); |
---|
| 371 | +#endif |
---|