qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Su Hang <suhang16@mails.ucas.ac.cn>,
	Thomas Huth <thuth@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] util/uri.c formating
Date: Tue, 20 Feb 2018 09:28:26 +0000	[thread overview]
Message-ID: <20180220092826.GD6021@redhat.com> (raw)
In-Reply-To: <CAFEAcA8GXtEJof8eiakbu3fDh_SafAnS_ywpPi6oXeT3qtQqJg@mail.gmail.com>

On Tue, Feb 20, 2018 at 09:14:16AM +0000, Peter Maydell wrote:
> On 20 February 2018 at 08:02, Su Hang <suhang16@mails.ucas.ac.cn> wrote:
> >  Formating the code with `clang-format -i util/uri.c`.
> >  My .clang-format file content is:
> >  '''
> >  IndentWidth: 4
> >  BreakBeforeBraces: Linux
> >  '''
> >
> > Then use `perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
> > to remove pattern like this: "return (1);"
> >
> > checkpatch.pl still rise these two kinds of "ERROR", I'm not sure
> > whether I should also suppress these, so I left it.
> >
> > '''
> > ERROR: braces {} are necessary even for single statement blocks
> > #1803: FILE: uri.c:1803:
> > +            while ((bas->path[cur] != 0) && (bas->path[cur] != '/'))
> > +                cur++;
> >
> > ERROR: braces {} are necessary for all arms of this statement
> > #1805: FILE: uri.c:1805:
> > +            if (bas->path[cur] == 0)
> > [...]
> > '''
> 
> In some places you have put in extra braces, like here:
> 
> > -    if (str == NULL)
> > -        return(-1);
> > +    if (str == NULL) {
> > +        return -1;
> > +    }
> 
> I think if we're going to reformat the file we might as well
> get it checkpatch-clean. Alternatively if you don't want to
> fix up the brace style then we needn't touch them at all.

I agree - lets get it 100% clean for checkpatch.

> One useful split for format-cleanup patches that you might
> consider is to have a patch which contains only whitespace
> cleanups, so that 'git show --ignore-all-space' shows no changes.
> That makes that patch easy to review. Then changes that do
> make non-whitespace changes can go in their own patch, which
> is generally smaller and so easier to review by eye.

Yes, 2 patches would be nicer.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

      reply	other threads:[~2018-02-20  9:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20  8:02 [Qemu-devel] [PATCH v2] util/uri.c formating Su Hang
2018-02-20  8:39 ` Thomas Huth
2018-02-20  9:14 ` Peter Maydell
2018-02-20  9:28   ` Daniel P. Berrangé [this message]

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

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

  git send-email \
    --in-reply-to=20180220092826.GD6021@redhat.com \
    --to=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=suhang16@mails.ucas.ac.cn \
    --cc=thuth@redhat.com \
    /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.
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 NNTP newsgroup(s).