From: Phillip Wood Date: Tue, 25 Mar 2025 16:28:32 GMT Subject: Re: [PATCH 1/2] remote-curl: avoid using the comma operator unnecessarily Message-ID: <930b4c9a-826f-4124-a70b-e0400a3fea5b@gmail.com> In-Reply-To: Hi Johannes On 25/03/2025 08:01, Johannes Schindelin via GitGitGadget wrote: > From: Johannes Schindelin > > The comma operator is a somewhat obscure C feature that is often used by > mistake and can even cause unintentional code flow. Better use a > semicolon instead. clang's -Wcomma finds another instance in this file @@ -1239,7 +1239,7 @@ static int fetch_git(struct discovery *heads, packet_buf_flush(&preamble); memset(&rpc, 0, sizeof(rpc)); - rpc.service_name = "git-upload-pack", + rpc.service_name = "git-upload-pack"; rpc.gzip_request = 1; err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result); In fact it finds a surprising number in our code base. I was worried there would be a lot of false positives but so far all of the ones I've looked at would be better not using a "," Best Wishes Phillip > Signed-off-by: Johannes Schindelin > --- > remote-curl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/remote-curl.c b/remote-curl.c > index 1273507a96c..57b515b37e7 100644 > --- a/remote-curl.c > +++ b/remote-curl.c > @@ -1401,7 +1401,7 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs) > packet_buf_flush(&preamble); > > memset(&rpc, 0, sizeof(rpc)); > - rpc.service_name = "git-receive-pack", > + rpc.service_name = "git-receive-pack"; > > err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result); > if (rpc_result.len)