qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] util/uri.c formating


From: Daniel P . Berrangé
Subject: Re: [Qemu-devel] [PATCH v2] util/uri.c formating
Date: Tue, 20 Feb 2018 09:28:26 +0000
User-agent: Mutt/1.9.2 (2017-12-15)

On Tue, Feb 20, 2018 at 09:14:16AM +0000, Peter Maydell wrote:
> On 20 February 2018 at 08:02, Su Hang <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]