summaryrefslogtreecommitdiff
path: root/src/alloc.h
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2025-04-09 13:24:53 -0700
committerGravatar Anshul Gupta <ansg191@anshulg.com> 2025-04-11 00:15:18 -0700
commitf277f41d83d450a1f28d350bb7d6da075d1d2741 (patch)
treee197a7de7e26b47cec57a46acdde4b6c74889ad5 /src/alloc.h
downloadgithub-mirror-f277f41d83d450a1f28d350bb7d6da075d1d2741.tar.gz
github-mirror-f277f41d83d450a1f28d350bb7d6da075d1d2741.tar.zst
github-mirror-f277f41d83d450a1f28d350bb7d6da075d1d2741.zip
Initial Commit
Add cmake github workflow Install dependencies in gh action Fix missing directory Fix compiler errors Fix group name to gid conversion Force cjson to statically link Add header guards to query headers Add install and cpack to CMakeLists.txt Add config search and CLI arg parsing Improve docs for git.c Fix program continuing on -h flag
Diffstat (limited to 'src/alloc.h')
-rw-r--r--src/alloc.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/alloc.h b/src/alloc.h
new file mode 100644
index 0000000..0a09a30
--- /dev/null
+++ b/src/alloc.h
@@ -0,0 +1,27 @@
+//
+// Created by Anshul Gupta on 4/9/25.
+//
+
+#ifndef ALLOC_H
+#define ALLOC_H
+
+#ifdef TEST_ALLOC
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <cmocka.h>
+#define gmalloc(size) test_malloc(size)
+#define gcalloc(num, size) test_calloc(num, size)
+#define grealloc(ptr, size) test_realloc(ptr, size)
+#define gfree(ptr) test_free(ptr)
+#else
+#include <stdlib.h>
+#define gmalloc(size) malloc(size)
+#define gcalloc(num, size) calloc(num, size)
+#define grealloc(ptr, size) realloc(ptr, size)
+#define gfree(ptr) free(ptr)
+#endif
+
+#endif // ALLOC_H