]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/htable.h
htable: add allocator hooks.
[ccan] / ccan / htable / htable.h
index 53c447c09b952b198913efa25a48b82d34777242..28755d617d67b7766d44fe3e5ce93d7956a85d55 100644 (file)
@@ -259,4 +259,11 @@ void *htable_prev_(const struct htable *htable, struct htable_iter *i);
        htable_delval_(htable_debug(htable, HTABLE_LOC), i)
 void htable_delval_(struct htable *ht, struct htable_iter *i);
 
+/**
+ * htable_set_allocator - set calloc/free functions.
+ * @alloc: allocator to use, must zero memory!
+ * @free: unallocator to use (@p is NULL or a return from @alloc)
+ */
+void htable_set_allocator(void *(*alloc)(struct htable *, size_t len),
+                         void (*free)(struct htable *, void *p));
 #endif /* CCAN_HTABLE_H */