RE: unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]
- From
Randall S. Becker <rsbecker@nexbridge.com>
- Date
- Jan 13, 2018, 17:30 UTC
- Message-ID
- <002501d38c94$3b9efd00$b2dcf700$@nexbridge.com>
- In-Reply-To
- <f139ed79-1e12-d7b6-dd24-ce77000917ec@web.de>
Show 15 quoted lines
> Sent: On January 13, 2018 12:13 PM, René Scharfe wrote: > Am 12.01.2018 um 20:52 schrieb Randall S. Becker: > > On a related too many warnings subject, hashmap.h has a variable > > unused (void *item). Is that addressed soon? If not, I can deal with > > it. > Here are the code lines containing the variable in question: > > void *item; > while ((item = hashmap_iter_next(&iter))) > > Intriguing. The variable "item" is set, but can be removed without effect. > GCC 7.2 and Clang 5 don't warn about that. > > The code was introduced by 8b604d1951 (hashmap: add API to disable item > counting when threaded) and there is no patch in pu that touches it again,
I was thinking about just changing it to the following and submitting the trivial patch:
while (hashmap_iter_next(&iter))
Avoids the frame allocation of void *item so should make it minimally faster when compiled without optimization.
Cheers, Randall