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

Re: [PATCH] branch: trivial style fix

From
Jeff King <peff@peff.net>
Date
Oct 15, 2018, 19:35 UTC
Message-ID
<20181015193525.GA8349@sigill.intra.peff.net>
In-Reply-To
<87bm87x5z2.fsf@ls-a.me>
On Sat, Oct 06, 2018 at 08:40:33AM +0800, Tao Qingyun wrote:
Show 23 quoted lines
> >> -	for (i = 0; i < argc; i++, strbuf_reset(&bname)) {
> >> +	for (i = 0; i < argc; i++) {
> >>  		char *target = NULL;
> >>  		int flags = 0;
> >>  
> >> +		strbuf_reset(&bname);
> >
> > This is not "trivial" nor "style fix", though.
> >
> > It is not "trivial" because it also changes the behaviour.  Instead
> > of resetting the strbuf each time after the loop body runs, the new
> > code resets it before the loop body, even for the 0-th iteration
> > where the strbuf hasn't even been used at all.  It is not a "style
> > fix" because we do not have a particular reason to avoid using the
> > comma operator to perform two simple expressions with side effects
> > inside a single expression.
> >
> Thank you and Jeff for your explanation. I think I get the point now.
> 
> The third part of `for` statement is normally for a step. I think it's
> improve readability even it does nothing in the first iteration.
> 
> And, should I drop this part and resend the patch? I'm a newbie :).

Sorry for the slow reply. For some reason I do not think your message here made it to the list (but I don't see anything obviously wrong with it).

Anyway, yes, I think it is worth dropping this hunk and re-sending the else-if style fix as a separate patch (you may choose to re-send this hunk as its own patch, too, if you want to argue for its inclusion, but there is no sense in holding the actual style fix hostage).

-Peff
Previous: Jeff KingNext: Tao Qingyun
Message 6 of 9 in “branch: trivial style fix”
  1. branch: trivial style fixTao Qingyun, Oct 5, 2018
  2. Jeff KingOct 5, 2018
  3. Junio C HamanoOct 5, 2018
  4. branch: trivial style fixTao Qingyun, Oct 16, 2018
  5. Jeff KingOct 16, 2018
  6. Jeff KingOct 15, 2018
  7. Tao QingyunOct 16, 2018
  8. Ævar Arnfjörð BjarmasonOct 16, 2018
  9. Jeff KingOct 16, 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.