chiark / gitweb /
Prep v231: Move elogind specific code in login/logind.c to login/elogind.c
[elogind.git] / src / basic / set.h
index 88a2cd74a6a09325996dd0a0623699d2ab7fccf6..5a5c8edb463f1b587010b61e1899bad941e10f7d 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 #pragma once
 
 /***
@@ -27,7 +25,6 @@
 Set *internal_set_new(const struct hash_ops *hash_ops  HASHMAP_DEBUG_PARAMS);
 #define set_new(ops) internal_set_new(ops  HASHMAP_DEBUG_SRC_ARGS)
 
-
 static inline Set *set_free(Set *s) {
         internal_hashmap_free(HASHMAP_BASE(s));
         return NULL;
@@ -128,11 +125,15 @@ int set_consume(Set *s, void *value);
 int set_put_strdup(Set *s, const char *p);
 #if 0 /// UNNEEDED by elogind
 int set_put_strdupv(Set *s, char **l);
+int set_put_strsplit(Set *s, const char *v, const char *separators, ExtractFlags flags);
 #endif // 0
 
 #define SET_FOREACH(e, s, i) \
         for ((i) = ITERATOR_FIRST; set_iterate((s), &(i), (void**)&(e)); )
 
+#define SET_FOREACH_MOVE(e, d, s)                                       \
+        for (; ({ e = set_first(s); assert_se(!e || set_move_one(d, s, e) >= 0); e; }); )
+
 DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free);
 DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free_free);