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

Re: [PATCH] sequencer: use return value of oidset_insert()

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 3, 2018, 20:14 UTC
Message-ID
<nycvar.QRO.7.76.6.1810032213330.73@tvgsbejvaqbjf.bet>
In-Reply-To
<18bf2384-694c-f98b-1c31-3c80c07bde2a@web.de>
Hi René,
On Wed, 3 Oct 2018, René Scharfe wrote:
Show 6 quoted lines
> oidset_insert() returns 1 if the object ID is already in the set and
> doesn't add it again, or 0 if it hadn't been present.  Make use of that
> fact instead of checking with an extra oidset_contains() call.
> 
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
ACK!

Thanks, Dscho

Show 21 quoted lines
>  sequencer.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index ddb41a62d9..6387c9ee6e 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -4146,9 +4146,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
>  			struct object_id *oid = &parent->item->object.oid;
>  			if (!oidset_contains(&interesting, oid))
>  				continue;
> -			if (!oidset_contains(&child_seen, oid))
> -				oidset_insert(&child_seen, oid);
> -			else
> +			if (oidset_insert(&child_seen, oid))
>  				label_oid(oid, "branch-point", &state);
>  		}
>  
> -- 
> 2.19.0
> 
Previous: René Scharfe
Message 2 of 2 in “sequencer: use return value of oidset_insert()”
  1. sequencer: use return value of oidset_insert()René Scharfe, Oct 3, 2018
  2. Johannes SchindelinOct 3, 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.