aboutsummaryrefslogtreecommitdiff
path: root/macro.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:16:30 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:18:19 +0100
commitdba60d8b985247be7f0b0eef0bc0cefef651c824 (patch)
tree853afca0b32884c279e1a949313873f9c0d649d6 /macro.h
parentStart using trie's instead of hash-maps. (diff)
downloadcalp-dba60d8b985247be7f0b0eef0bc0cefef651c824.tar.gz
calp-dba60d8b985247be7f0b0eef0bc0cefef651c824.tar.xz
Fix crash.
Diffstat (limited to 'macro.h')
-rw-r--r--macro.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/macro.h b/macro.h
index 89178cb3..ce2bfd21 100644
--- a/macro.h
+++ b/macro.h
@@ -63,4 +63,13 @@
T N; \
CONSTRUCT(T, & N, __VA_ARGS__);
+/* Destructor for type */
+#define FREE(T) TP(T, __free)
+
+/* Call destructor for type, and free object */
+#define FFREE(T, N) do { FREE(T)(N); free(N); } while (0)
+
+/* Declare destructor */
+#define FREE_DECL(T) TP(T, __free) (T* this)
+
#endif /* MACRO_H */