{"thread":{"id":"49477","subject":"[PATCH] sequencer: use return value of oidset_insert()","startedAt":"2018-10-03T13:06:57Z","lastAt":"2018-10-03T20:14:30Z","messageCount":2,"participants":["René Scharfe","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"359514","messageId":"18bf2384-694c-f98b-1c31-3c80c07bde2a@web.de","threadId":"49477","inReplyTo":null,"subject":"[PATCH] sequencer: use return value of oidset_insert()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2018-10-03T13:06:49Z","receivedAt":"2018-10-03T13:06:57Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"oidset_insert() returns 1 if the object ID is already in the set and\ndoesn't add it again, or 0 if it hadn't been present.  Make use of that\nfact instead of checking with an extra oidset_contains() call.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n sequencer.c | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex ddb41a62d9..6387c9ee6e 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -4146,9 +4146,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n \t\t\tstruct object_id *oid = &parent->item->object.oid;\n \t\t\tif (!oidset_contains(&interesting, oid))\n \t\t\t\tcontinue;\n-\t\t\tif (!oidset_contains(&child_seen, oid))\n-\t\t\t\toidset_insert(&child_seen, oid);\n-\t\t\telse\n+\t\t\tif (oidset_insert(&child_seen, oid))\n \t\t\t\tlabel_oid(oid, \"branch-point\", &state);\n \t\t}\n \n-- \n2.19.0\n"},{"id":"359587","messageId":"nycvar.QRO.7.76.6.1810032213330.73@tvgsbejvaqbjf.bet","threadId":"49477","inReplyTo":"18bf2384-694c-f98b-1c31-3c80c07bde2a@web.de","subject":"Re: [PATCH] sequencer: use return value of oidset_insert()","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-10-03T20:14:28Z","receivedAt":"2018-10-03T20:14:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi René,\n\nOn Wed, 3 Oct 2018, René Scharfe wrote:\n\n> oidset_insert() returns 1 if the object ID is already in the set and\n> doesn't add it again, or 0 if it hadn't been present.  Make use of that\n> fact instead of checking with an extra oidset_contains() call.\n> \n> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n> ---\n\nACK!\n\nThanks,\nDscho\n\n>  sequencer.c | 4 +---\n>  1 file changed, 1 insertion(+), 3 deletions(-)\n> \n> diff --git a/sequencer.c b/sequencer.c\n> index ddb41a62d9..6387c9ee6e 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -4146,9 +4146,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n>  \t\t\tstruct object_id *oid = &parent->item->object.oid;\n>  \t\t\tif (!oidset_contains(&interesting, oid))\n>  \t\t\t\tcontinue;\n> -\t\t\tif (!oidset_contains(&child_seen, oid))\n> -\t\t\t\toidset_insert(&child_seen, oid);\n> -\t\t\telse\n> +\t\t\tif (oidset_insert(&child_seen, oid))\n>  \t\t\t\tlabel_oid(oid, \"branch-point\", &state);\n>  \t\t}\n>  \n> -- \n> 2.19.0\n> "}]}