]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hashmap: add helper to test if iterator is still at beginning
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Apr 2021 15:20:58 +0000 (17:20 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 May 2021 13:47:09 +0000 (15:47 +0200)
src/basic/hashmap.h

index c855f39b1d37389cdbca0c7d025f0a1268d6f401..f7ade2e774f377a7b521170aa48e05c15b32a233 100644 (file)
@@ -51,6 +51,7 @@ typedef struct {
 
 #define _IDX_ITERATOR_FIRST (UINT_MAX - 1)
 #define ITERATOR_FIRST ((Iterator) { .idx = _IDX_ITERATOR_FIRST, .next_key = NULL })
+#define ITERATOR_IS_FIRST(i) ((i).idx == _IDX_ITERATOR_FIRST)
 
 /* Macros for type checking */
 #define PTR_COMPATIBLE_WITH_HASHMAP_BASE(h) \