summaryrefslogtreecommitdiff
path: root/set.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-26 04:18:44 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-26 04:18:44 +0100
commit034c6ed7da5e44bfdde5a5d0da75f7b7a59953b8 (patch)
treeea59315075d3ebda2de695b1bd0621d79fa9e987 /set.h
parent9152c765065184d0c1267ed2499e3fe4cac53755 (diff)
first attempt at proper service/socket logic
Diffstat (limited to 'set.h')
-rw-r--r--set.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/set.h b/set.h
index d8ef7aa540..a16cbedbfc 100644
--- a/set.h
+++ b/set.h
@@ -14,8 +14,9 @@
typedef struct Set Set;
Set *set_new(hash_func_t hash_func, compare_func_t compare_func);
-Set* set_copy(Set *s);
void set_free(Set* s);
+Set* set_copy(Set *s);
+int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func);
int set_put(Set *s, void *value);
int set_replace(Set *s, void *value);
@@ -27,18 +28,19 @@ int set_merge(Set *s, Set *other);
unsigned set_size(Set *s);
bool set_isempty(Set *s);
-void *set_iterate(Set *s, void **state);
-void *set_iterate_backwards(Set *s, void **state);
+void *set_iterate(Set *s, Iterator *i);
+void *set_iterate_backwards(Set *s, Iterator *i);
+void *set_iterate_skip(Set *s, void *value, Iterator *i);
void set_clear(Set *s);
void *set_steal_first(Set *s);
void* set_first(Set *s);
void* set_last(Set *s);
-#define SET_FOREACH(e, s, state) \
- for ((state) = NULL, (e) = set_iterate((s), &(state)); (e); (e) = set_iterate((s), &(state)))
+#define SET_FOREACH(e, s, i) \
+ for ((i) = ITERATOR_FIRST, (e) = set_iterate((s), &(i)); (e); (e) = set_iterate((s), &(i)))
-#define SET_FOREACH_BACKWARDS(e, s, state) \
- for ((state) = NULL, (e) = set_iterate_backwards((s), &(state)); (e); (e) = set_iterate_backwards((s), &(state)))
+#define SET_FOREACH_BACKWARDS(e, s, i) \
+ for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i)))
#endif