util: Use set_foreach instead of rolling our own
authorThomas Helland <thomashelland90@gmail.com>
Wed, 15 Apr 2015 21:08:19 +0000 (23:08 +0200)
committerThomas Helland <thomashelland90@gmail.com>
Wed, 14 Mar 2018 19:03:57 +0000 (20:03 +0100)
This follows the same pattern as in the hash_table.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
src/util/set.c

index 392506639547d0d13cfbe89c8d5026f03e34a9bb..d71f771807f48913dff867e22c5f9da148dc338e 100644 (file)
@@ -230,12 +230,8 @@ set_rehash(struct set *ht, unsigned new_size_index)
    ht->entries = 0;
    ht->deleted_entries = 0;
 
-   for (entry = old_ht.table;
-        entry != old_ht.table + old_ht.size;
-        entry++) {
-      if (entry_is_present(entry)) {
-         set_add(ht, entry->hash, entry->key);
-      }
+   set_foreach(&old_ht, entry) {
+      set_add(ht, entry->hash, entry->key);
    }
 
    ralloc_free(old_ht.table);