From a4e94c3c2a564121f43d2b24da510766ec717280 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 13 Sep 2014 15:07:15 +0200 Subject: hack to make the test work without gnu c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/test/user.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/test/user.c') diff --git a/src/test/user.c b/src/test/user.c index a9980ed..f2a1d50 100644 --- a/src/test/user.c +++ b/src/test/user.c @@ -17,11 +17,41 @@ */ #include "user.h" -#include "methods.h" -#include -#include -#include +#ifdef __GCC__ +# include +#else +/* Hack to circumvent that the funcions are defined multiples. */ +# define strlen strlen_ +# define memcpy memcpy_ +# define strchr strchr_ +static size_t strlen_(const char* str) +{ + size_t n = 0; + while (str[n]) + n++; + return n; +} +static void* memcpy_(void* dest, const void* src, size_t n) +{ + char* restrict d = dest; + const char* restrict s = src; + size_t i; + for (i = 0; i < n; i++) + d[i] = s[i]; + return dest; +} +static char* strchr_(const char* s, int c) +{ + char find = (char)c; + while (*s) + if (*s == find) + return s; + else + s++; + return NULL; +} +#endif /** -- cgit v1.2.3-70-g09d2