From: Lennart Poettering Date: Tue, 13 Apr 2021 15:20:58 +0000 (+0200) Subject: hashmap: add helper to test if iterator is still at beginning X-Git-Tag: v249-rc1~155^2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=641d3761d45c53000195ed4c6fff7d0d08cdc912;p=thirdparty%2Fsystemd.git hashmap: add helper to test if iterator is still at beginning --- diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h index c855f39b1d3..f7ade2e774f 100644 --- a/src/basic/hashmap.h +++ b/src/basic/hashmap.h @@ -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) \