aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/slist.c2
-rw-r--r--src/utils/trie.c2
-rw-r--r--src/utils/utils.h8
3 files changed, 7 insertions, 5 deletions
diff --git a/src/utils/slist.c b/src/utils/slist.c
index e0c1a44..a606977 100644
--- a/src/utils/slist.c
+++ b/src/utils/slist.c
@@ -32,7 +32,7 @@ b_slist_append(b_slist_t *l, void *data)
void
-b_slist_free_full(b_slist_t *l, void (*free_func)(void *ptr))
+b_slist_free_full(b_slist_t *l, b_free_func_t free_func)
{
while (l != NULL) {
b_slist_t *tmp = l->next;
diff --git a/src/utils/trie.c b/src/utils/trie.c
index d33c600..f1b77eb 100644
--- a/src/utils/trie.c
+++ b/src/utils/trie.c
@@ -13,7 +13,7 @@
b_trie_t*
-b_trie_new(void (*free_func)(void *ptr))
+b_trie_new(b_free_func_t free_func)
{
b_trie_t *trie = b_malloc(sizeof(b_trie_t));
trie->root = NULL;
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 7e61a67..03f1639 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -15,6 +15,8 @@
#define B_STRING_CHUNK_SIZE 128
+typedef void (*b_free_func_t) (void *ptr);
+
typedef struct _b_slist_t {
struct _b_slist_t *next;
void *data;
@@ -34,11 +36,11 @@ typedef struct _b_trie_node_t {
typedef struct _b_trie_t {
b_trie_node_t *root;
- void (*free_func)(void *ptr);
+ b_free_func_t free_func;
} b_trie_t;
b_slist_t* b_slist_append(b_slist_t *l, void *data);
-void b_slist_free_full(b_slist_t *l, void (*free_func)(void *ptr));
+void b_slist_free_full(b_slist_t *l, b_free_func_t free_func);
void b_slist_free(b_slist_t *l);
unsigned int b_slist_length(b_slist_t *l);
@@ -62,7 +64,7 @@ b_string_t* b_string_append(b_string_t *str, const char *suffix);
b_string_t* b_string_append_c(b_string_t *str, char c);
b_string_t* b_string_append_printf(b_string_t *str, const char *format, ...);
-b_trie_t* b_trie_new(void (*free_func)(void *ptr));
+b_trie_t* b_trie_new(b_free_func_t free_func);
void b_trie_free(b_trie_t *trie);
void b_trie_insert(b_trie_t *trie, const char *key, void *data);
void* b_trie_lookup(b_trie_t *trie, const char *key);