util,test: introduce cleanup function prioq_freep()

This also simplifies test-prioq.c.
This commit is contained in:
Yu Watanabe
2018-10-16 22:17:08 +09:00
parent bbddd2b8d9
commit d13b5f5a85
2 changed files with 18 additions and 44 deletions
+1
View File
@@ -12,6 +12,7 @@ typedef struct Prioq Prioq;
Prioq *prioq_new(compare_func_t compare);
Prioq *prioq_free(Prioq *q);
DEFINE_TRIVIAL_CLEANUP_FUNC(Prioq*, prioq_free);
int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func);
int prioq_put(Prioq *q, void *data, unsigned *idx);