aboutsummaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test.c')
-rw-r--r--test.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test.c b/test.c
index 05d74d4..ad5a4bc 100644
--- a/test.c
+++ b/test.c
@@ -3,6 +3,9 @@
#include "test.h"
#include <malloc.h>
+#undef strndup
+#undef memdup
+
size_t alloc_fail_in = 0;
@@ -185,6 +188,28 @@ pvalloc(size_t size)
}
+char *
+strdup(const char *s)
+{
+ char *r = malloc(strlen(s) + 1);
+ return r ? strcpy(r, s) : r;
+}
+
+
+char *
+strndup(const char *s, size_t size)
+{
+ return libsimple_strndup(s, size);
+}
+
+
+void *
+memdup(const void *s, size_t size)
+{
+ return libsimple_memdup(s, size);
+}
+
+
void
free(void *ptr)
{