summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b6ae80)
raw | patch | inline | side by side (parent: 0b6ae80)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Sep 2013 20:11:20 +0000 (22:11 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Sep 2013 20:11:20 +0000 (22:11 +0200) |
This is to make sure that comparators always use the same signature.
src/include/utils/llist.h | patch | blob | history | |
src/utils/llist.c | patch | blob | history |
index c37c2719af46803b08aedf45c08a61148fe5e6b0..4bf9d605ad74e8d46e28c262a8c92470acf6dc47 100644 (file)
struct sdb_llist_iter;
typedef struct sdb_llist_iter sdb_llist_iter_t;
+typedef int (*sdb_llist_cmp_cb)(const sdb_object_t *, const sdb_object_t *);
+
/*
* sdb_llist_create, sdb_llist_destroy:
* Create and destroy a doubly linked list object.
* - a negative value on failure
*/
int
-sdb_llist_insert_sorted(sdb_llist_t *list, sdb_object_t *obj,
- int (*compare)(const sdb_object_t *, const sdb_object_t *));
+sdb_llist_insert_sorted(sdb_llist_t *list,
+ sdb_object_t *obj, sdb_llist_cmp_cb);
/*
* sdb_llist_search:
* - NULL else
*/
sdb_object_t *
-sdb_llist_search(sdb_llist_t *list, const sdb_object_t *key,
- int (*compare)(const sdb_object_t *, const sdb_object_t *));
+sdb_llist_search(sdb_llist_t *list,
+ const sdb_object_t *key, sdb_llist_cmp_cb);
/*
* sdb_llist_search_by_name:
diff --git a/src/utils/llist.c b/src/utils/llist.c
index b606324e56f96b5510a48f10f7a27d4a30db57a0..dfc8fb99d18ecfeb6e38cc0a7339426854691704 100644 (file)
--- a/src/utils/llist.c
+++ b/src/utils/llist.c
} /* sdb_llist_insert */
int
-sdb_llist_insert_sorted(sdb_llist_t *list, sdb_object_t *obj,
- int (*compare)(const sdb_object_t *, const sdb_object_t *))
+sdb_llist_insert_sorted(sdb_llist_t *list,
+ sdb_object_t *obj, sdb_llist_cmp_cb compare)
{
sdb_llist_elem_t *prev;
sdb_llist_elem_t *next;
} /* sdb_llist_insert_sorted */
sdb_object_t *
-sdb_llist_search(sdb_llist_t *list, const sdb_object_t *key,
- int (*compare)(const sdb_object_t *, const sdb_object_t *))
+sdb_llist_search(sdb_llist_t *list,
+ const sdb_object_t *key, sdb_llist_cmp_cb compare)
{
sdb_llist_elem_t *elem;