From 9fa76fb95addb6caff9a94231617f205314fa4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Wed, 6 Nov 2019 17:56:26 +0100 Subject: [PATCH] Add missing file --- cctools/include/foreign/strings.h | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 cctools/include/foreign/strings.h diff --git a/cctools/include/foreign/strings.h b/cctools/include/foreign/strings.h new file mode 100644 index 0000000..e49d38a --- /dev/null +++ b/cctools/include/foreign/strings.h @@ -0,0 +1,40 @@ +#include_next + +#undef bcmp +#undef bzero +#undef bcopy + +#ifndef HAVE_BCMP +static inline int bcmp(const void *s1, const void *s2, size_t n) +{ + return __builtin_memcmp(s1, s2, n); +} +#endif + +#ifndef HAVE_BZERO +static inline void bzero(void *s, size_t n) +{ + __builtin_memset(s, '\0', n); +} +#endif + +#ifndef HAVE_BCOPY +static inline void bcopy(const void *src, void *dest, size_t n) +{ + __builtin_memcpy(dest, src, n); +} +#endif + +#ifndef HAVE_INDEX +static inline char *index(const char *s, int c) +{ + return __builtin_strchr(s, c); +} +#endif + +#ifndef HAVE_RINDEX +static inline char *rindex(const char *s, int c) +{ + return __builtin_strrchr(s, c); +} +#endif