chiark / gitweb /
hashmap: fix iterators to not skip entries
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 14 Jun 2015 14:51:35 +0000 (16:51 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:02:58 +0000 (10:02 +0100)
Currently, the HASHMAP iterators stop at the first NULL entry in a
hashmap. This is non-obvious and breaks users like sd-device, which
legitimately store NULL values in a hashmap.

Fix all the iterators by taking a pointer to the value storage, instead of
returning it. The iterators now return a boolean that tells whether the
end of the list was reached.

Current users of HASHMAP_FOREACH() are *NOT* changed to explicitly check
for NULL. If it turns out, there were users that inserted NULL into
hashmaps, but didn't properly check for it during iteration, then we
really want to find those and fix them.


No differences found