mirror of
https://github.com/systemd/systemd.git
synced 2025-02-13 01:57:42 +03:00
hashmap: avoid uninitialized variable warning in internal_hashmap_clear()
GCC 8.2 with LTO and -O2 emits a false warning: src/basic/hashmap.c: In function 'internal_hashmap_free.constprop': src/basic/hashmap.c:898:33: error: 'k' may be used uninitialized in this function [-Werror=maybe-uninitialized] free_key(k); ^ Avoid it by initializing the variable.
This commit is contained in:
parent
e298df69a2
commit
ca3237150e
@ -888,7 +888,8 @@ void internal_hashmap_clear(HashmapBase *h, free_func_t default_free_key, free_f
|
||||
* themselves from our hash table a second time, the entry is already gone. */
|
||||
|
||||
while (internal_hashmap_size(h) > 0) {
|
||||
void *v, *k;
|
||||
void *k = NULL;
|
||||
void *v;
|
||||
|
||||
v = internal_hashmap_first_key_and_value(h, true, &k);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user