diff options
author | Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> | 2021-04-05 15:24:32 +0200 |
---|---|---|
committer | Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> | 2021-04-05 15:24:32 +0200 |
commit | 5ccd7e60ad475b481144437c8e4037a56f32e4a0 (patch) | |
tree | d6482ad8df05b7619c152dee51ff39b75ce13ee1 /lib/hamt.c | |
parent | 8b32ec4d89de0549c76ef09230681b95cada6996 (diff) | |
download | gnulib-5ccd7e60ad475b481144437c8e4037a56f32e4a0.tar.gz |
hamt: Fix coding errors.
Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00047.html>
after a Coverity run.
* lib/hamt.c (bucket_do_while, hamt_iterator): Add missing
derefencing operator and silence a bogus warning on uninitialized
variables.
* tests/test-hamt.c (test_general): Replace two errorneous
assignment operators with comparison operators.
Diffstat (limited to 'lib/hamt.c')
-rw-r--r-- | lib/hamt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/hamt.c b/lib/hamt.c index 204c2f0690..34880eff48 100644 --- a/lib/hamt.c +++ b/lib/hamt.c @@ -873,7 +873,7 @@ bucket_do_while (const struct bucket *bucket, Hamt_processor *proc, void *data, for (size_t i = 0; i < elt_count; ++i) { *success = proc (elts[i], data); - if (!success) + if (*success == false) return cnt; ++cnt; } @@ -946,14 +946,14 @@ hamt_iterator (Hamt *hamt) Hamt_iterator iter; iter.hamt = hamt_copy (hamt); Hamt_entry *entry = hamt->root; + iter.path = 0; + iter.position = 0; if (entry == NULL) { iter.depth = -1; return iter; } iter.depth = 0; - iter.path = 0; - iter.position = 0; while (iter.entry[iter.depth] = entry, entry_type (entry) == subtrie_entry) { const struct subtrie *subtrie = (const struct subtrie *) entry; |