X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Futils%2Fllist.h;h=354e97665649fa915fdd67e7a08d330d73db5e71;hp=c115bf2e5107f3cfaa11a540da07b8e7c0c23ade;hb=bef7167f0dc1fd405e35d5cbffb3c0820945a9ea;hpb=3a179f6f4ad2586325656b49bd9d5a53efc8700c diff --git a/src/include/utils/llist.h b/src/include/utils/llist.h index c115bf2..354e976 100644 --- a/src/include/utils/llist.h +++ b/src/include/utils/llist.h @@ -1,5 +1,5 @@ /* - * syscollector - src/include/utils/llist.h + * SysDB - src/include/utils/llist.h * Copyright (C) 2012 Sebastian 'tokkee' Harl * All rights reserved. * @@ -25,8 +25,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SC_UTILS_LLIST_H -#define SC_UTILS_LLIST_H 1 +#ifndef SDB_UTILS_LLIST_H +#define SDB_UTILS_LLIST_H 1 #include "core/object.h" @@ -34,27 +34,27 @@ extern "C" { #endif -struct sc_llist; -typedef struct sc_llist sc_llist_t; +struct sdb_llist; +typedef struct sdb_llist sdb_llist_t; -struct sc_llist_iter; -typedef struct sc_llist_iter sc_llist_iter_t; +struct sdb_llist_iter; +typedef struct sdb_llist_iter sdb_llist_iter_t; /* - * sc_llist_create, sc_llist_destroy: + * sdb_llist_create, sdb_llist_destroy: * Create and destroy a doubly linked list object. * - * sc_llist_create returns NULL on error. - * sc_llist_destroy will also destroy all remaining elements, thus releasing + * sdb_llist_create returns NULL on error. + * sdb_llist_destroy will also destroy all remaining elements, thus releasing * the included objects (decrement the ref-count). */ -sc_llist_t * -sc_llist_create(void); +sdb_llist_t * +sdb_llist_create(void); void -sc_llist_destroy(sc_llist_t *list); +sdb_llist_destroy(sdb_llist_t *list); /* - * sc_llist_clone: + * sdb_llist_clone: * Clone an existing list. The objects stored in the list will not be copied * but rather their reference count incremented. * @@ -62,11 +62,11 @@ sc_llist_destroy(sc_llist_t *list); * - the copied list on success * - NULL else */ -sc_llist_t * -sc_llist_clone(sc_llist_t *list); +sdb_llist_t * +sdb_llist_clone(sdb_llist_t *list); /* - * sc_llist_append: + * sdb_llist_append: * Append the given 'obj' to the end of 'list'. The list will take ownership * of the object, that is, increment the reference count by one. In case the * caller does not longer use the object for other purposes, it should thus @@ -77,10 +77,10 @@ sc_llist_clone(sc_llist_t *list); * - a negative value on failure */ int -sc_llist_append(sc_llist_t *list, sc_object_t *obj); +sdb_llist_append(sdb_llist_t *list, sdb_object_t *obj); /* - * sc_llist_insert: + * sdb_llist_insert: * Insert the new element at the specified position (zero being the head of * the list; the length of the list being the tail)). If the index is greater * than the length of the list (i.e. past the tail of the list), an error is @@ -93,10 +93,10 @@ sc_llist_append(sc_llist_t *list, sc_object_t *obj); * - a negative value on failure */ int -sc_llist_insert(sc_llist_t *list, sc_object_t *obj, size_t index); +sdb_llist_insert(sdb_llist_t *list, sdb_object_t *obj, size_t index); /* - * sc_llist_insert_sorted: + * sdb_llist_insert_sorted: * Insert the given 'obj' in the 'list' using a sort order as determined by * the 'compare' function. The function will insert the new entry before the * first entry which sorts later than the new entry. It will not ensure that @@ -113,24 +113,24 @@ sc_llist_insert(sc_llist_t *list, sc_object_t *obj, size_t index); * - a negative value on failure */ int -sc_llist_insert_sorted(sc_llist_t *list, sc_object_t *obj, - int (*compare)(const sc_object_t *, const sc_object_t *)); +sdb_llist_insert_sorted(sdb_llist_t *list, sdb_object_t *obj, + int (*compare)(const sdb_object_t *, const sdb_object_t *)); -/* sc_llist_search: +/* sdb_llist_search: * Search for a 'key' in the given 'list'. The function will return the first * entry that matches the specified 'key'. For that purpose, the 'compare' * function is used. It should return 0 iff the two arguments compare equal. * * Returns: - * - a pointer the sc_object_t containing the matching entry + * - a pointer the sdb_object_t containing the matching entry * - NULL else */ -sc_object_t * -sc_llist_search(sc_llist_t *list, const sc_object_t *key, - int (*compare)(const sc_object_t *, const sc_object_t *)); +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 *)); /* - * sc_llist_shift: + * sdb_llist_shift: * Removes and returns the first element of the list. The ref-count of the * item will not be changed, that is, if the element will not be used any * further, it should be re-referenced by the caller. @@ -139,29 +139,29 @@ sc_llist_search(sc_llist_t *list, const sc_object_t *key, * - the former first element of the list * - NULL if the list is empty */ -sc_object_t * -sc_llist_shift(sc_llist_t *list); +sdb_object_t * +sdb_llist_shift(sdb_llist_t *list); -/* sc_llist_get_iter, sc_llist_iter_has_next, sc_llist_iter_get_next: +/* sdb_llist_get_iter, sdb_llist_iter_has_next, sdb_llist_iter_get_next: * Iterate through the list, element by element. * - * sc_llist_iter_get_next returns NULL if there is no next element. + * sdb_llist_iter_get_next returns NULL if there is no next element. */ -sc_llist_iter_t * -sc_llist_get_iter(sc_llist_t *list); +sdb_llist_iter_t * +sdb_llist_get_iter(sdb_llist_t *list); void -sc_llist_iter_destroy(sc_llist_iter_t *iter); +sdb_llist_iter_destroy(sdb_llist_iter_t *iter); _Bool -sc_llist_iter_has_next(sc_llist_iter_t *iter); -sc_object_t * -sc_llist_iter_get_next(sc_llist_iter_t *iter); +sdb_llist_iter_has_next(sdb_llist_iter_t *iter); +sdb_object_t * +sdb_llist_iter_get_next(sdb_llist_iter_t *iter); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* ! SC_UTILS_LLIST_H */ +#endif /* ! SDB_UTILS_LLIST_H */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */