| 1 |
// SPDX-License-Identifier: BSD-2-Clause-Patent |
| 2 |
#ifdef SHIM_UNIT_TEST |
| 3 |
#include_next <string.h> |
| 4 |
|
| 5 |
__typeof__(strlen) shim_strlen; |
| 6 |
__typeof__(strcmp) shim_strcmp; |
| 7 |
__typeof__(strncmp) shim_strncmp; |
| 8 |
__typeof__(strncasecmp) shim_strncasecmp; |
| 9 |
__typeof__(strcasecmp) shim_strcasecmp; |
| 10 |
__typeof__(strrchr) shim_strrchr; |
| 11 |
__typeof__(strrchr) shim_strrchr; |
| 12 |
__typeof__(strnlen) shim_strnlen; |
| 13 |
__typeof__(strcpy) shim_strcpy; |
| 14 |
__typeof__(strncpy) shim_strncpy; |
| 15 |
__typeof__(strdup) shim_strdup; |
| 16 |
__typeof__(strndup) shim_strndup; |
| 17 |
__typeof__(stpcpy) shim_stpcpy; |
| 18 |
__typeof__(strchrnul) shim_strchrnul; |
| 19 |
__typeof__(strchr) shim_strchr; |
| 20 |
|
| 21 |
#else |
| 22 |
#ifndef _STRING_H |
| 23 |
#define _STRING_H |
| 24 |
|
| 25 |
#include <stddef.h> |
| 26 |
|
| 27 |
#include <builtins_begin_.h> |
| 28 |
|
| 29 |
mkbi1_(long int, ffsl, long int, x) |
| 30 |
mkbi1_(long int, clzl, long int, x) |
| 31 |
mkbi1_(long int, ctzl, long int, x) |
| 32 |
mkbi1_(long int, clrsbl, long int, x) |
| 33 |
mkbi1_(long int, popcountl, long int, x) |
| 34 |
mkbi1_(long int, parityl, long int, x) |
| 35 |
mkbi1_(long long int, ffsll, long long int, x) |
| 36 |
mkbi1_(long long int, clzll, long long int, x) |
| 37 |
mkbi1_(long long int, ctzll, long long int, x) |
| 38 |
mkbi1_(long long int, clrsbll, long long int, x) |
| 39 |
mkbi1_(long long int, popcountll, long long int, x) |
| 40 |
mkbi1_(long long int, parityll, long long int, x) |
| 41 |
|
| 42 |
mkbi3_(int, bcmp, const void *, s1, const void *, s2, size_t, n) |
| 43 |
mkbi3_(void, bcopy, const void *, src, void *, dest, size_t, n) |
| 44 |
mkbi2_(void, bzero, void *, s, size_t, n) |
| 45 |
mkdepbi2_(char *, index, const char *, s, int, c) |
| 46 |
mkbi3_(void *, memchr, const void *, s, int, c, size_t, n) |
| 47 |
mkbi3_(int, memcmp, const void *, s1, const void *, s2, size_t, n) |
| 48 |
mkbi3_(void *, memcpy, void *, dest, const void *, src, size_t, n) |
| 49 |
mkbi3_(void *, memmove, void *, dest, const void *, src, size_t, n) |
| 50 |
mkbi3_(void *, mempcpy, void *, dest, const void *, src, size_t, n) |
| 51 |
mkdepbi2_(char *, rindex, const char *, s, int, c) |
| 52 |
mkdepbi2_(char *, stpcpy, char *, dest, const char *, src) |
| 53 |
mkbi3_(char *, stpncpy, char *, dest, const char *, src, size_t, n) |
| 54 |
mkdepbi2_(int, strcasecmp, const char *, s1, const char *, s2) |
| 55 |
mkdepbi2_(char *, strcat, char *, dest, const char *, src) |
| 56 |
mkdepbi2_(char *, strchr, const char *, s, int, c) |
| 57 |
mkdepbi2_(int, strcmp, const char *, s1, const char *, s2) |
| 58 |
mkdepbi2_(char *, strcpy, char *, dest, const char *, src) |
| 59 |
mkdepbi2_(size_t, strcspn, const char *, s, const char *, reject) |
| 60 |
mkdepbi1_(char *, strdup, const char *, s) |
| 61 |
mkbi2_(char *, strndup, const char *, s, size_t, n) |
| 62 |
mkdepbi1_(size_t, strlen, const char *, s) |
| 63 |
mkbi3_(int, strncasecmp, const char *, s1, const char *, s2, size_t, n) |
| 64 |
mkbi3_(char *, strncat, char *, dest, const char *, src, size_t, n) |
| 65 |
mkbi3_(int, strncmp, const char *, s1, const char *, s2, size_t, n) |
| 66 |
mkbi3_(char *, strncpy, char *, dest, const char *, src, size_t, n) |
| 67 |
#if defined(__GNUC__) && __GNUC__ >= 9 |
| 68 |
mkbi2_(size_t, strnlen, const char *, s1, size_t, n) |
| 69 |
#else |
| 70 |
size_t strnlen(const char * s1, size_t n); |
| 71 |
#endif |
| 72 |
mkdepbi2_(char *, strpbrk, const char *, s, const char *, accept) |
| 73 |
mkdepbi2_(char *, strrchr, const char *, s, int, c) |
| 74 |
mkdepbi2_(size_t, strspn, const char *, s, const char *, accept) |
| 75 |
mkdepbi2_(char *, strstr, const char *, haystack, const char *, needle) |
| 76 |
|
| 77 |
mkbi3_(void *, memset, void *, s, int, c, size_t, n); |
| 78 |
|
| 79 |
#include <builtins_end_.h> |
| 80 |
|
| 81 |
#endif /* _STRING_H */ |
| 82 |
#endif |