aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/user.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-13 15:07:15 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-13 15:07:15 +0200
commita4e94c3c2a564121f43d2b24da510766ec717280 (patch)
treef4194e8148607eba6496bb93b0c885ea9f1ca862 /src/test/user.c
parentm (diff)
downloadlibgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.gz
libgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.bz2
libgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.xz
hack to make the test work without gnu c
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/test/user.c38
1 files changed, 34 insertions, 4 deletions
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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#ifdef __GCC__
+# include <string.h>
+#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
/**