On 20 February 2018 at 08:02, Su Hang <suhan...@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. 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. thanks -- PMM