summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 042881b)
raw | patch | inline | side by side (parent: 042881b)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 5 Jul 2014 09:15:56 +0000 (11:15 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 5 Jul 2014 09:15:56 +0000 (11:15 +0200) |
src/include/core/object.h | patch | blob | history | |
src/include/utils/llist.h | patch | blob | history | |
src/utils/llist.c | patch | blob | history |
index 819d11e849b48d4e1e2eb65d35247f4abe22af29..42352b085876b48cbbaca7716670d05c4bc06d14 100644 (file)
#define SDB_OBJ_WRAPPER(obj) ((sdb_object_wrapper_t *)(obj))
#define SDB_CONST_OBJ_WRAPPER(obj) ((const sdb_object_wrapper_t *)(obj))
+/*
+ * Callback types for comparing objects or performing object lookup.
+ */
+typedef int (*sdb_object_cmp_cb)(const sdb_object_t *, const sdb_object_t *);
+typedef int (*sdb_object_lookup_cb)(const sdb_object_t *, const void *user_data);
+
/*
* sdb_object_create:
* Allocates a new sdb_object_t of the specified 'name' and 'type'. The object
index 28816a6a49abaaf58232f55ab5b7e9a9f6a2ffa8..1dddb7e0747391a677ac267f36560b2d385d2a89 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 *);
-typedef int (*sdb_llist_lookup_cb)(const sdb_object_t *, const void *user_data);
-
/*
* sdb_llist_create, sdb_llist_destroy:
* Create and destroy a doubly linked list object.
*/
int
sdb_llist_insert_sorted(sdb_llist_t *list,
- sdb_object_t *obj, sdb_llist_cmp_cb);
+ sdb_object_t *obj, sdb_object_cmp_cb);
/*
* sdb_llist_get:
*/
sdb_object_t *
sdb_llist_search(sdb_llist_t *list,
- sdb_llist_lookup_cb lookup, const void *user_data);
+ sdb_object_lookup_cb lookup, const void *user_data);
/*
* sdb_llist_search_by_name:
*/
sdb_object_t *
sdb_llist_remove(sdb_llist_t *list,
- sdb_llist_lookup_cb lookup, const void *user_data);
+ sdb_object_lookup_cb lookup, const void *user_data);
/*
* sdb_llist_remove_by_name:
diff --git a/src/utils/llist.c b/src/utils/llist.c
index f9bf722785dab30087c2c6e796858f3decd3f4a7..03ffd95350f5acf992a7d9edd27acc7ed45c18b3 100644 (file)
--- a/src/utils/llist.c
+++ b/src/utils/llist.c
static sdb_llist_elem_t *
llist_search(sdb_llist_t *list,
- sdb_llist_lookup_cb lookup, const void *user_data)
+ sdb_object_lookup_cb lookup, const void *user_data)
{
sdb_llist_elem_t *elem;
int
sdb_llist_insert_sorted(sdb_llist_t *list,
- sdb_object_t *obj, sdb_llist_cmp_cb compare)
+ sdb_object_t *obj, sdb_object_cmp_cb compare)
{
sdb_llist_elem_t *prev;
sdb_llist_elem_t *next;
sdb_object_t *
sdb_llist_search(sdb_llist_t *list,
- sdb_llist_lookup_cb lookup, const void *user_data)
+ sdb_object_lookup_cb lookup, const void *user_data)
{
sdb_llist_elem_t *elem;
sdb_object_t *
sdb_llist_remove(sdb_llist_t *list,
- sdb_llist_lookup_cb lookup, const void *user_data)
+ sdb_object_lookup_cb lookup, const void *user_data)
{
sdb_llist_elem_t *elem;
sdb_object_t *obj = NULL;