git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: René ScharfeNext: tboegi@web.de
Message 5 of 6 in “Fixed pervasive enumeration warning in convert.h.”
  1. Fixed pervasive enumeration warning in convert.h.randall.s.becker@rogers.com, Jan 12, 2018
  2. Junio C HamanoJan 12, 2018
  3. Randall S. BeckerJan 12, 2018
  4. unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]René Scharfe, Jan 13, 2018
  5. Randall S. BeckerJan 13, 2018
  6. 1/1 convert_to_git(): safe_crlf/checksafe becomes int conv_flagstboegi@web.de, Jan 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.