diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-01-22 14:16:30 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-01-22 14:18:19 +0100 |
commit | dba60d8b985247be7f0b0eef0bc0cefef651c824 (patch) | |
tree | 853afca0b32884c279e1a949313873f9c0d649d6 /macro.h | |
parent | Start using trie's instead of hash-maps. (diff) | |
download | calp-dba60d8b985247be7f0b0eef0bc0cefef651c824.tar.gz calp-dba60d8b985247be7f0b0eef0bc0cefef651c824.tar.xz |
Fix crash.
Diffstat (limited to '')
-rw-r--r-- | macro.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 */ |