diff options
author | Eric Engestrom <[email protected]> | 2018-10-20 18:00:09 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2018-10-25 12:43:18 +0100 |
commit | e27902a261361e8a7980db14138ef13753db196d (patch) | |
tree | 021b6638314baf37073766f1092e2be736da75aa /src/util | |
parent | bb84fa146f2252f22999205a2904d8a948bffd3b (diff) |
util: use C99 declaration in the for-loop set_foreach() macro
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/set.c | 6 | ||||
-rw-r--r-- | src/util/set.h | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/util/set.c b/src/util/set.c index feef96d16ea..fe5b10f0fee 100644 --- a/src/util/set.c +++ b/src/util/set.c @@ -168,8 +168,6 @@ _mesa_set_destroy(struct set *ht, void (*delete_function)(struct set_entry *entr return; if (delete_function) { - struct set_entry *entry; - set_foreach (ht, entry) { delete_function(entry); } @@ -187,8 +185,6 @@ _mesa_set_destroy(struct set *ht, void (*delete_function)(struct set_entry *entr void _mesa_set_clear(struct set *set, void (*delete_function)(struct set_entry *entry)) { - struct set_entry *entry; - if (!set) return; @@ -256,7 +252,7 @@ static void set_rehash(struct set *ht, unsigned new_size_index) { struct set old_ht; - struct set_entry *table, *entry; + struct set_entry *table; if (new_size_index >= ARRAY_SIZE(hash_sizes)) return; diff --git a/src/util/set.h b/src/util/set.h index ffd19a798bd..54719e4c8ab 100644 --- a/src/util/set.h +++ b/src/util/set.h @@ -96,9 +96,9 @@ _mesa_set_random_entry(struct set *set, * insertion (which may rehash the set, making entry a dangling * pointer). */ -#define set_foreach(set, entry) \ - for (entry = _mesa_set_next_entry(set, NULL); \ - entry != NULL; \ +#define set_foreach(set, entry) \ + for (struct set_entry *entry = _mesa_set_next_entry(set, NULL); \ + entry != NULL; \ entry = _mesa_set_next_entry(set, entry)) #ifdef __cplusplus |