On Sun, Feb 25, 2018 at 12:35:55PM +0800, Su Hang wrote: > Su Hang (3): > util/uri.c: Coding style check, Only whitespace involved. > util/uri.c: remove brackets () that wrap `return` statement's content. > util/uri.c: wrap single statement blocks with braces {} > > util/uri.c | 1753 > ++++++++++++++++++++++++++++++++---------------------------- > 1 file changed, 940 insertions(+), 813 deletions(-) > > Using `git diff -w` to make sure that the first patch only contains > whitespace changes, replace all TAB with whitespace. > Here is what I actually use: > ''' > [core] > whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent > > git diff -w --word-diff-regex=[^[:space:]] > ''' > > For second patch, using > `perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c` > to remove brackets () that wrap `return` statement's content. > Changing patterns like this: > `return (a);` to `return a;`. > > For third patch, using curly braces to wrap `if` `while` `else` > statements, > which only hold single statement. For example: > ''' > if (cond) > statement; > ''' > to > ''' > if (cond) { > statement; > } > ''' > > And using tricks that compare the disassemblies before and after > code changes, to make sure code logic isn't changed: > ''' > git checkout master > make util/uri.o > strip util/uri.o > objdump -Drx util/uri.o > /tmp/uri-master.txt > git checkout cleanupbranch > make util/uri.o > strip util/uri.o > objdump -Drx util/uri.o > /tmp/uri-cleanup.txt > diff -u /tmp/uri-*.txt > ''' > > -- > 2.7.4 > >
Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan
signature.asc
Description: PGP signature