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

RE: [PATCH] strmap: make callers of strmap_remove() to call it in void context

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Dec 15, 2020, 21:35 UTC
Message-ID
<004a01d6d32a$3b92ec60$b2b8c520$@nexbridge.com>
In-Reply-To
<xmqqtusm7odr.fsf_-_@gitster.c.googlers.com>
Show 7 quoted lines
> -----Original Message-----
> From: Junio C Hamano <gitster@pobox.com>
> Sent: December 15, 2020 4:26 PM
> To: Elijah Newren <newren@gmail.com>; Randall S. Becker
> <rsbecker@nexbridge.com>
> Cc: Jeff King <peff@peff.net>; Git Mailing List <git@vger.kernel.org>
> Subject: [PATCH] strmap: make callers of strmap_remove() to call it in
void
> context
> 
> Two "static inline" functions, both of which return void, call
> strmap_remove() and tries to return the value it returns as their return
value,
> which is just bogus, as strmap_remove() returns void itself.  Call it in
the void
Show 16 quoted lines
> context and fall-thru the control to the end instead.
> 
> Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  strmap.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/strmap.h b/strmap.h
> index c4c104411b..1e152d832d 100644
> --- a/strmap.h
> +++ b/strmap.h
> @@ -165,7 +165,7 @@ static inline int strintmap_contains(struct strintmap
> *map, const char *str)
> 
>  static inline void strintmap_remove(struct strintmap *map, const char
*str)  {
Show 15 quoted lines
> -	return strmap_remove(&map->map, str, 0);
> +	strmap_remove(&map->map, str, 0);
>  }
> 
>  static inline int strintmap_empty(struct strintmap *map) @@ -249,7 +249,7
> @@ static inline int strset_contains(struct strset *set, const char *str)
> 
>  static inline void strset_remove(struct strset *set, const char *str)  {
> -	return strmap_remove(&set->map, str, 0);
> +	strmap_remove(&set->map, str, 0);
>  }
> 
>  static inline int strset_empty(struct strset *set)
> --
> 2.30.0-rc0-186-g20447144ec
Looks good from here.

Regards, Randall

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 12 in “Re: [ANNOUNCE] git-2.30.0-rc0 - Compile Fails on HPE NonStop”
  1. Randall S. BeckerDec 14, 2020
  2. Junio C HamanoDec 15, 2020
  3. Jeff KingDec 15, 2020
  4. Randall S. BeckerDec 15, 2020
  5. Elijah NewrenDec 15, 2020
  6. Junio C HamanoDec 15, 2020
  7. Junio C HamanoDec 15, 2020
  8. strmap: make callers of strmap_remove() to call it in void contextJunio C Hamano, Dec 15, 2020
  9. Randall S. BeckerDec 15, 2020
  10. compat-util: pretend that stub setitimer() always succeedsJunio C Hamano, Dec 15, 2020
  11. Jeff KingDec 15, 2020
  12. Junio C HamanoDec 16, 2020

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.