Re: [PATCH 1/2] Cleanup for a return statement in source files

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

 



On 2012年03月22日 19:33, Martin Kletzander wrote:
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 nonsenses.

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_'
---
  examples/dominfo/info1.c                  |    2 +-
  examples/domsuspend/suspend.c             |    6 +-
  python/generator.py                       |    8 +-
  python/libvirt-override.c                 |  216 +++++++++++++-------------
  python/libvirt-qemu-override.c            |    4 +-
  python/typewrappers.c                     |   76 +++++-----
  src/conf/domain_conf.c                    |   22 ++--
  src/conf/interface_conf.c                 |   70 +++++-----
  src/conf/nwfilter_params.c                |    2 +-
  src/cpu/cpu_x86.c                         |    2 +-
  src/datatypes.c                           |   80 +++++-----
  src/interface/netcf_driver.c              |    2 +-
  src/lxc/lxc_driver.c                      |    4 +-
  src/nwfilter/nwfilter_ebiptables_driver.c |    4 +-
  src/qemu/qemu_command.c                   |    6 +-
  src/qemu/qemu_driver.c                    |    4 +-
  src/qemu/qemu_process.c                   |    2 +-
  src/remote/remote_driver.c                |    2 +-
  src/security/security_selinux.c           |    2 +-
  src/test/test_driver.c                    |    8 +-
  src/util/conf.c                           |  106 +++++++-------
  src/util/hooks.c                          |   20 ++--
  src/util/sexpr.c                          |   14 +-
  src/util/util.c                           |    8 +-
  src/util/uuid.c                           |    6 +-
  src/util/virhash.c                        |   30 ++--
  src/util/virmacaddr.c                     |    2 +-
  src/util/virnetlink.c                     |    2 +-
  src/util/virsocketaddr.c                  |   48 +++---
  src/util/virterror.c                      |   14 +-
  src/util/xml.c                            |   50 +++---
  src/xen/xen_driver.c                      |   32 ++--
  src/xen/xen_hypervisor.c                  |  228 ++++++++++++++--------------
  src/xen/xend_internal.c                   |  234 ++++++++++++++--------------
  src/xen/xm_internal.c                     |   98 ++++++------
  src/xen/xs_internal.c                     |  120 ++++++++--------
  src/xenapi/xenapi_driver.c                |    2 +-
  src/xenxs/xen_sxpr.c                      |    2 +-
  src/xenxs/xen_xm.c                        |    2 +-
  tests/commandtest.c                       |    4 +-
  tests/cputest.c                           |    2 +-
  tests/domainsnapshotxml2xmltest.c         |    4 +-
  tests/interfacexml2xmltest.c              |    2 +-
  tests/networkxml2argvtest.c               |    2 +-
  tests/networkxml2xmltest.c                |    2 +-
  tests/nodedevxml2xmltest.c                |    2 +-
  tests/nodeinfotest.c                      |    2 +-
  tests/nwfilterxml2xmltest.c               |    2 +-
  tests/qemuargv2xmltest.c                  |    2 +-
  tests/qemuxml2argvtest.c                  |    2 +-
  tests/qemuxml2xmltest.c                   |    4 +-
  tests/qemuxmlnstest.c                     |    2 +-
  tests/qparamtest.c                        |    2 +-
  tests/sexpr2xmltest.c                     |    4 +-
  tests/sockettest.c                        |    2 +-
  tests/statstest.c                         |    2 +-
  tests/storagepoolxml2xmltest.c            |    2 +-
  tests/storagevolxml2xmltest.c             |    2 +-
  tests/virbuftest.c                        |    2 +-
  tests/virnetmessagetest.c                 |    2 +-
  tests/virnetsockettest.c                  |    4 +-
  tests/virnettlscontexttest.c              |    2 +-
  tests/virshtest.c                         |    2 +-
  tests/virtimetest.c                       |    2 +-
  tests/xencapstest.c                       |    2 +-
  tests/xmconfigtest.c                      |    4 +-
  tests/xml2sexprtest.c                     |    4 +-
  tools/virsh.c                             |    8 +-
  68 files changed, 809 insertions(+), 809 deletions(-)

Quite long, but looks good, ACK.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]