diff options
author | Martin Kletzander <mkletzan@redhat.com> | 2012-03-22 12:33:35 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-26 14:45:22 -0600 |
commit | 9943276fd2d068756a5f11c4e1aa22e915ddb0c9 (patch) | |
tree | 6b064566d611988d6ea7320673c5bb292dc52fb7 /examples | |
parent | Fix and test round-trip of query parameters (diff) | |
download | libvirt-9943276fd2d068756a5f11c4e1aa22e915ddb0c9.tar.gz libvirt-9943276fd2d068756a5f11c4e1aa22e915ddb0c9.tar.bz2 libvirt-9943276fd2d068756a5f11c4e1aa22e915ddb0c9.zip |
Cleanup for a return statement in source files
Return statements with parameter enclosed in parentheses were modified
and parentheses were removed. The whole change was scripted, here is how:
List of files was obtained using this command:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \
grep -e '\.[ch]$' -e '\.py$'
Found files were modified with this command:
sed -i -e \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
Then checked for nonsense.
The whole command looks like this:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \
grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dominfo/info1.c | 2 | ||||
-rw-r--r-- | examples/domsuspend/suspend.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/dominfo/info1.c b/examples/dominfo/info1.c index 601e9f247..4d578bcae 100644 --- a/examples/dominfo/info1.c +++ b/examples/dominfo/info1.c @@ -59,5 +59,5 @@ int main() { getDomainInfo(0); - return(0); + return 0; } diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c index bae1b8d6e..a6311d104 100644 --- a/examples/domsuspend/suspend.c +++ b/examples/domsuspend/suspend.c @@ -30,9 +30,9 @@ checkDomainState(virDomainPtr dom) { ret = virDomainGetInfo(dom, &info); if (ret < 0) { - return(-1); + return -1; } - return(info.state); + return info.state; } /** @@ -130,5 +130,5 @@ int main(int argc, char **argv) { error: if (conn != NULL) virConnectClose(conn); - return(0); + return 0; } |