p_delete(array); \
} \
}
+#define A(Type) Type ## _array_t
#define ARRAY_INIT { NULL, 0, 0 }
#define array_elt(array, n) (array).data[(n)]
#define array_ptr(array, n) (array).data + (n)
+#define array_foreach(array, action) \
+ for (int __Ai = 0 ; __Ai < (array).len ; ++__Ai) { \
+ action(array_ptr(array, __Ai)); \
+ }
+#define array_deep_wipe(array, wipe) \
+ do { \
+ array_foreach(array, wipe); \
+ array_wipe(array); \
+ } while (0)
+
ARRAY(char)
ARRAY(int)
#include "str.h"
#include "array.h"
-typedef char_array_t buffer_t;
+typedef A(char) buffer_t;
#define BUFFER_INIT {NULL, 0, 0}
ARRAY(trie_entry_t)
struct trie_t {
- trie_entry_t_array_t entries;
- char_array_t c;
- char_array_t keys;
- int_array_t keys_offset;
+ A(trie_entry_t) entries;
+ A(char) c;
+ A(char) keys;
+ A(int) keys_offset;
bool locked;
};