Protect against uninitialized hash map (if initialized to `{0}`)
@@ -209,12 +209,12 @@ struct fio_hash_s {
#undef FIO_HASH_FOR_LOOP
#define FIO_HASH_FOR_LOOP(hash, container) \
for (fio_hash_data_ordered_s *container = (hash)->ordered; \
- !FIO_HASH_KEY_ISINVALID(container->key); ++container)
+ container && !FIO_HASH_KEY_ISINVALID(container->key); ++container)
#undef FIO_HASH_FOR_EMPTY
#define FIO_HASH_FOR_EMPTY(hash, container) \
for (fio_hash_data_ordered_s *container = (hash)->ordered; \
- !FIO_HASH_KEY_ISINVALID(container->key) || \
+ container && !FIO_HASH_KEY_ISINVALID(container->key) || \
(((hash)->pos = (hash)->count = 0) != 0 || \
(free((hash)->map), \
((hash)->map = \
@@ -227,7 +227,7 @@ struct fio_hash_s {
#undef FIO_HASH_FOR_FREE
#define FIO_HASH_FOR_FREE(hash, container) \
for (fio_hash_data_ordered_s *container = (hash)->ordered; \
- !FIO_HASH_KEY_ISINVALID(container->key) || \
+ container && !FIO_HASH_KEY_ISINVALID(container->key) || \
((fio_hash_free(hash), 0) != 0); \
FIO_HASH_KEY_DESTROY(container->key), (++container))
