]> git.draconx.ca Git - cdecl99.git/blobdiff - t/errmemwrap.c
libcdecl: Fix TLS cleanup on Windows.
[cdecl99.git] / t / errmemwrap.c
similarity index 88%
rename from t/memwrap.c
rename to t/errmemwrap.c
index 8b54433afbeeeb793b6d8090f5afc2f61d347bfe..85541e19d398b4bd21c7b05d0c067f6b83888016 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
+
+#ifndef TEST_MALLOC_HOOK
+#  define TEST_MALLOC_HOOK 1
+#endif
 #include "cdecl-internal.h"
+#undef malloc
 
 static union test_alloc {
        union test_alloc *p;
@@ -68,7 +73,7 @@ void *test_realloc_hook(void *p, size_t n)
                return NULL;
 
        n = (n + sizeof *alloc - 1) / sizeof *alloc;
-       alloc = (malloc)((n + ALLOC_PAYLOAD) * sizeof *alloc);
+       alloc = malloc((n + ALLOC_PAYLOAD) * sizeof *alloc);
        if (!alloc)
                return NULL;
 
@@ -114,3 +119,13 @@ size_t test_live_allocations(void)
 
        return ret;
 }
+
+/*
+ * Function called from output.c but not needed for error messaging
+ * (only current user of this file)
+ */
+const char *cdecl__token_name(unsigned token)
+{
+       printf("Bail out! stub cdecl__token_name called\n");
+       exit(99);
+}