git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Tao Qingyun <taoqy@ls-a.me>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, sbeller@google.com
Subject: Re: [PATCH] branch: trivial style fix
Date: Mon, 15 Oct 2018 15:35:26 -0400	[thread overview]
Message-ID: <20181015193525.GA8349@sigill.intra.peff.net> (raw)
In-Reply-To: <87bm87x5z2.fsf@ls-a.me>

On Sat, Oct 06, 2018 at 08:40:33AM +0800, Tao Qingyun wrote:

> >> -	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

  parent reply	other threads:[~2018-10-15 19:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  9:52 [PATCH] branch: trivial style fix Tao Qingyun
2018-10-05 16:21 ` Jeff King
2018-10-05 16:47 ` Junio C Hamano
     [not found]   ` <87bm87x5z2.fsf@ls-a.me>
2018-10-15 19:35     ` Jeff King [this message]
2018-10-16 14:14       ` Tao Qingyun
2018-10-16 14:27         ` Ævar Arnfjörð Bjarmason
2018-10-16 15:32           ` Jeff King
2018-10-16 14:19 ` [PATCH v2] " Tao Qingyun
2018-10-16 15:33   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181015193525.GA8349@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.com \
    --cc=taoqy@ls-a.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).