[libvirt] [PATCH] Remove duplicate empty lines and correct indentation and style

Matthias Bolte matthias.bolte at googlemail.com
Thu Jul 7 14:33:53 UTC 2011


2011/7/7 Daniel P. Berrange <berrange at redhat.com>:
> On Thu, Jul 07, 2011 at 03:55:01AM -0400, Laine Stump wrote:
>> On 07/07/2011 03:24 AM, Matthias Bolte wrote:
>> >No functional change included.
>> >---
>> >  python/libvirt-override.c                 |    1 -
>> >  src/conf/domain_conf.c                    |    1 -
>> >  src/conf/interface_conf.c                 |    1 -
>> >  src/conf/network_conf.c                   |    1 -
>> >  src/conf/node_device_conf.c               |    4 -
>> >  src/conf/storage_conf.c                   |    1 -
>> >  src/interface/netcf_driver.c              |   16 ++----
>> >  src/libxl/libxl_driver.c                  |    2 +-
>> >  src/lxc/lxc_driver.c                      |    2 +-
>> >  src/node_device/node_device_driver.c      |    2 -
>> >  src/node_device/node_device_linux_sysfs.c |    2 -
>> >  src/nwfilter/nwfilter_ebiptables_driver.c |    2 -
>> >  src/openvz/openvz_driver.c                |   87 ++++++++++++++---------------
>> >  src/qemu/qemu_capabilities.c              |    2 +-
>> >  src/qemu/qemu_command.c                   |    2 +-
>> >  src/qemu/qemu_driver.c                    |   10 +--
>> >  src/qemu/qemu_process.c                   |    1 -
>> >  src/rpc/virnetclient.c                    |    2 -
>> >  src/rpc/virnetserverservice.c             |    2 -
>> >  src/uml/uml_driver.c                      |    2 -
>> >  src/xen/xen_driver.c                      |    1 -
>> >  src/xen/xs_internal.c                     |   12 ++--
>> >  src/xenxs/xen_xm.c                        |    1 -
>> >  tests/virnetsockettest.c                  |    3 -
>> >  24 files changed, 60 insertions(+), 100 deletions(-)
>> >
>> >diff --git a/python/libvirt-override.c b/python/libvirt-override.c
>>
>> True, there don't appear to be any functional changes, and it's nice
>> to have a consistent style to the code. My only problem with this
>> type of commit is that it increases the chances of merge conflicts
>> now and in the future (when someone tries to backport a bugfix to
>> some stable downstream release.) (I periodically have a desire to
>> make similar changes, but then discourage myself for that reason;
>> maybe I'm just too conservative)

Well, you have a point there.

>> I assume these were found by an automated tool - do just these
>> changes make all of the source in libvirt consistent to "the style"?

No, this is just what I found during manual code inspection.

>> Especially if that's the case, I lean more towards pushing them than
>> not; hopefully any merge conflicts that come up will be easy to
>> solve (definitely easier than the ones caused by actual functional
>> changes in the code!), and we can start enforcing the style.
>>
>> So, 1/2 ACK, but wait for someone else to give their 1/2 ACK.
>
>
> ACK.  Yes it causes merge pain, but we're usually better off over
> the long term with this sort of thing.

This is just the tip of the iceberg. A while ago I tweak the config
for uncrustify, a code formatter. Here's the diffstat after
autoformatting the current codebase

 examples/domain-events/events-c/event-test.c |  173 ++--
 examples/domsuspend/suspend.c                |    2 +-
 examples/hellolibvirt/hellolibvirt.c         |    2 +-
 examples/openauth/openauth.c                 |    8 +-
 python/libvirt-override.c                    |  388 ++++----
 python/typewrappers.c                        |    4 +-
 python/typewrappers.h                        |  112 +-
 src/conf/capabilities.c                      |   68 +-
 src/conf/capabilities.h                      |    2 +-
 src/conf/cpu_conf.c                          |   65 +-
 src/conf/domain_conf.c                       |  557 +++++-----
 src/conf/domain_conf.h                       |   30 +-
 src/conf/domain_event.c                      |   46 +-
 src/conf/domain_event.h                      |   28 +-
 src/conf/domain_nwfilter.h                   |    2 +-
 src/conf/interface_conf.c                    |  429 ++++----
 src/conf/interface_conf.h                    |    4 +-
 src/conf/network_conf.c                      |   64 +-
 src/conf/network_conf.h                      |    4 +-
 src/conf/node_device_conf.c                  |   79 +-
 src/conf/node_device_conf.h                  |   60 +-
 src/conf/nwfilter_conf.c                     |  734 +++++++-------
 src/conf/nwfilter_conf.h                     |  134 ++--
 src/conf/nwfilter_params.h                   |    8 +-
 src/conf/secret_conf.c                       |    6 +-
 src/conf/secret_conf.h                       |    2 +-
 src/conf/storage_conf.c                      |  187 ++--
 src/conf/storage_encryption_conf.c           |   10 +-
 src/conf/storage_encryption_conf.h           |    2 +-
 src/cpu/cpu.c                                |   44 +-
 src/cpu/cpu.h                                |  120 +-
 src/cpu/cpu_generic.c                        |   18 +-
 src/cpu/cpu_map.c                            |   14 +-
 src/cpu/cpu_map.h                            |    6 +-
 src/cpu/cpu_x86.c                            |  113 +-
 src/datatypes.c                              |   18 +-
 src/datatypes.h                              |  148 ++--
 src/driver.h                                 | 1506 +++++++++++++-------------
 src/esx/esx_driver.c                         |  260 +++---
 src/esx/esx_storage_driver.c                 |   84 +-
 src/esx/esx_util.c                           |   14 +-
 src/esx/esx_vi.c                             |  464 ++++----
 src/esx/esx_vi.h                             |   84 +-
 src/esx/esx_vi_methods.c                     |   98 +-
 src/esx/esx_vi_methods.h                     |   18 +-
 src/esx/esx_vi_types.c                       |  684 ++++++------
 src/esx/esx_vi_types.h                       |   28 +-
 src/fdstream.c                               |   22 +-
 src/interface/netcf_driver.c                 |   75 +-
 src/internal.h                               |   30 +-
 src/libvirt.c                                | 1042 +++++++++---------
 src/libvirt_internal.h                       |   56 +-
 src/libxl/libxl_conf.c                       |  217 ++--
 src/libxl/libxl_conf.h                       |    2 +-
 src/libxl/libxl_driver.c                     |  547 +++++-----
 src/locking/domain_lock.c                    |   25 +-
 src/locking/lock_driver_sanlock.c            |   22 +-
 src/locking/lock_manager.c                   |   14 +-
 src/lxc/lxc_conf.c                           |    6 +-
 src/lxc/lxc_container.c                      |   56 +-
 src/lxc/lxc_controller.c                     |   31 +-
 src/lxc/lxc_driver.c                         |   55 +-
 src/lxc/veth.c                               |   12 +-
 src/lxc/veth.h                               |   22 +-
 src/network/bridge_driver.c                  |   78 +-
 src/node_device/node_device_driver.c         |    6 +-
 src/node_device/node_device_hal.c            |   24 +-
 src/node_device/node_device_linux_sysfs.c    |   10 +-
 src/node_device/node_device_udev.c           |   55 +-
 src/nodeinfo.c                               |   78 +-
 src/nwfilter/nwfilter_driver.c               |   18 +-
 src/nwfilter/nwfilter_ebiptables_driver.c    |  459 ++++----
 src/nwfilter/nwfilter_gentech_driver.c       |  105 +-
 src/nwfilter/nwfilter_learnipaddr.c          |   74 +-
 src/nwfilter/nwfilter_learnipaddr.h          |    4 +-
 src/openvz/openvz_conf.c                     |   66 +-
 src/openvz/openvz_conf.h                     |    4 +-
 src/openvz/openvz_driver.c                   |  103 +-
 src/phyp/phyp_driver.c                       |  144 ++-
 src/qemu/qemu_audit.c                        |   10 +-
 src/qemu/qemu_audit.h                        |   30 +-
 src/qemu/qemu_bridge_filter.c                |   22 +-
 src/qemu/qemu_bridge_filter.h                |    8 +-
 src/qemu/qemu_capabilities.c                 |   29 +-
 src/qemu/qemu_cgroup.c                       |   14 +-
 src/qemu/qemu_command.c                      |  365 ++++---
 src/qemu/qemu_command.h                      |   68 +-
 src/qemu/qemu_conf.c                         |  140 ++--
 src/qemu/qemu_domain.c                       |   17 +-
 src/qemu/qemu_domain.h                       |    4 +-
 src/qemu/qemu_driver.c                       |  434 ++++----
 src/qemu/qemu_hostdev.c                      |    6 +-
 src/qemu/qemu_hotplug.c                      |   58 +-
 src/qemu/qemu_migration.c                    |   91 +-
 src/qemu/qemu_migration.h                    |    6 +-
 src/qemu/qemu_monitor.c                      |   92 +-
 src/qemu/qemu_monitor.h                      |   12 +-
 src/qemu/qemu_monitor_json.c                 |   54 +-
 src/qemu/qemu_monitor_text.c                 |  154 ++--
 src/qemu/qemu_monitor_text.h                 |    4 +-
 src/qemu/qemu_process.c                      |  104 +-
 src/remote/remote_driver.c                   |  948 ++++++++--------
 src/remote/remote_driver.h                   |    2 +-
 src/rpc/virnetclient.c                       |   44 +-
 src/rpc/virnetclientprogram.c                |    8 +-
 src/rpc/virnetclientstream.c                 |   10 +-
 src/rpc/virnetmessage.c                      |   10 +-
 src/rpc/virnetmessage.h                      |   20 +-
 src/rpc/virnetsaslcontext.c                  |   22 +-
 src/rpc/virnetsaslcontext.h                  |    2 +-
 src/rpc/virnetserver.c                       |   42 +-
 src/rpc/virnetserverclient.c                 |   12 +-
 src/rpc/virnetservermdns.c                   |  124 ++--
 src/rpc/virnetserverprogram.c                |    8 +-
 src/rpc/virnetserverservice.c                |    8 +-
 src/rpc/virnetsocket.c                       |   22 +-
 src/rpc/virnettlscontext.c                   |   30 +-
 src/rpc/virnettlscontext.h                   |    4 +-
 src/secret/secret_driver.c                   |   18 +-
 src/security/security_apparmor.c             |   48 +-
 src/security/security_apparmor.h             |    2 +-
 src/security/security_dac.c                  |   32 +-
 src/security/security_driver.c               |    2 +-
 src/security/security_driver.h               |   98 +-
 src/security/security_nop.c                  |    4 +-
 src/security/security_selinux.c              |   27 +-
 src/security/virt-aa-helper.c                |  225 ++--
 src/storage/parthelper.c                     |    4 +-
 src/storage/storage_backend.c                |   86 +-
 src/storage/storage_backend.h                |    8 +-
 src/storage/storage_backend_disk.c           |  116 +-
 src/storage/storage_backend_fs.c             |   35 +-
 src/storage/storage_backend_iscsi.c          |   14 +-
 src/storage/storage_backend_logical.c        |   27 +-
 src/storage/storage_backend_mpath.c          |    2 +-
 src/storage/storage_backend_scsi.c           |    5 +-
 src/storage/storage_driver.c                 |   50 +-
 src/test/test_driver.c                       |  341 +++---
 src/uml/uml_conf.c                           |   67 +-
 src/uml/uml_conf.h                           |    4 +-
 src/uml/uml_driver.c                         |   72 +-
 src/util/authhelper.c                        |    4 +-
 src/util/bitmap.c                            |    4 +-
 src/util/bitmap.h                            |    8 +-
 src/util/bridge.c                            |   26 +-
 src/util/bridge.h                            |  110 +-
 src/util/buf.c                               |   15 +-
 src/util/buf.h                               |   10 +-
 src/util/cgroup.c                            |   42 +-
 src/util/command.c                           |   78 +-
 src/util/command.h                           |   20 +-
 src/util/conf.c                              |  158 ++--
 src/util/conf.h                              |   55 +-
 src/util/dnsmasq.c                           |   18 +-
 src/util/dnsmasq.h                           |   10 +-
 src/util/ebtables.c                          |   24 +-
 src/util/ebtables.h                          |   24 +-
 src/util/event.c                             |   12 +-
 src/util/event_poll.c                        |   70 +-
 src/util/event_poll.h                        |   12 +-
 src/util/hash.c                              |    6 +-
 src/util/hash.h                              |    8 +-
 src/util/hooks.c                             |   26 +-
 src/util/hostusb.c                           |   10 +-
 src/util/hostusb.h                           |    2 +-
 src/util/interface.c                         |   22 +-
 src/util/iohelper.c                          |    7 +-
 src/util/iptables.c                          |    4 +-
 src/util/iptables.h                          |  152 ++--
 src/util/json.c                              |   32 +-
 src/util/logging.c                           |  134 ++-
 src/util/logging.h                           |   16 +-
 src/util/macvtap.c                           |   69 +-
 src/util/macvtap.h                           |   10 +-
 src/util/memory.c                            |   16 +-
 src/util/memory.h                            |   16 +-
 src/util/netlink.c                           |   10 +-
 src/util/network.c                           |   42 +-
 src/util/network.h                           |   40 +-
 src/util/pci.c                               |   59 +-
 src/util/pci.h                               |   48 +-
 src/util/processinfo.c                       |    8 +-
 src/util/qparams.c                           |   96 +-
 src/util/qparams.h                           |   30 +-
 src/util/sexpr.c                             |   31 +-
 src/util/sexpr.h                             |    2 +-
 src/util/stats_linux.c                       |   26 +-
 src/util/storage_file.c                      |  166 ++--
 src/util/sysinfo.c                           |   12 +-
 src/util/sysinfo.h                           |    2 +-
 src/util/threadpool.h                        |    2 +-
 src/util/threads-pthread.h                   |    6 +-
 src/util/threads-win32.c                     |    6 +-
 src/util/threads.h                           |    4 +-
 src/util/util.c                              |  133 ++-
 src/util/util.h                              |   52 +-
 src/util/uuid.c                              |    6 +-
 src/util/virtaudit.h                         |   10 +-
 src/util/virterror.c                         | 1273 ++++++++++++----------
 src/util/virterror_internal.h                |   16 +-
 src/util/xml.c                               |   14 +-
 src/util/xml.h                               |   20 +-
 src/vbox/vbox_MSCOMGlue.c                    |   14 +-
 src/vbox/vbox_V2_2.c                         |    2 +-
 src/vbox/vbox_V3_0.c                         |    2 +-
 src/vbox/vbox_V3_1.c                         |    2 +-
 src/vbox/vbox_V3_2.c                         |    2 +-
 src/vbox/vbox_V4_0.c                         |    2 +-
 src/vbox/vbox_XPCOMCGlue.c                   |    2 +-
 src/vbox/vbox_driver.c                       |   24 +-
 src/vbox/vbox_tmpl.c                         |  422 ++++----
 src/vmware/vmware_conf.c                     |   20 +-
 src/vmware/vmware_conf.h                     |    6 +-
 src/vmware/vmware_driver.c                   |   48 +-
 src/vmx/vmx.c                                |  618 ++++++------
 src/vmx/vmx.h                                |    2 +-
 src/xen/block_stats.c                        |   67 +-
 src/xen/block_stats.h                        |    6 +-
 src/xen/xen_driver.c                         |  431 ++++----
 src/xen/xen_driver.h                         |   88 +-
 src/xen/xen_hypervisor.c                     |  783 +++++++-------
 src/xen/xen_hypervisor.h                     |  174 ++--
 src/xen/xen_inotify.c                        |   44 +-
 src/xen/xen_inotify.h                        |    8 +-
 src/xen/xend_internal.c                      |  554 +++++-----
 src/xen/xend_internal.h                      |   56 +-
 src/xen/xm_internal.c                        |   81 +-
 src/xen/xm_internal.h                        |    6 +-
 src/xen/xs_internal.c                        |  115 +-
 src/xen/xs_internal.h                        |   80 +-
 src/xenapi/xenapi_driver.c                   |  216 ++--
 src/xenapi/xenapi_utils.c                    |   45 +-
 src/xenapi/xenapi_utils.h                    |    6 +-
 src/xenxs/xen_sxpr.c                         |  242 ++---
 src/xenxs/xen_sxpr.h                         |    4 +-
 src/xenxs/xen_xm.c                           |  205 ++--
 tests/commandhelper.c                        |   14 +-
 tests/commandtest.c                          |   32 +-
 tests/conftest.c                             |    2 +-
 tests/cputest.c                              |   15 +-
 tests/esxutilstest.c                         |   35 +-
 tests/eventtest.c                            |   18 +-
 tests/hashdata.h                             |  150 ++--
 tests/hashtest.c                             |    4 +-
 tests/interfacexml2xmltest.c                 |    8 +-
 tests/jsontest.c                             |    4 +-
 tests/networkxml2argvtest.c                  |    8 +-
 tests/networkxml2xmltest.c                   |    8 +-
 tests/nodedevxml2xmltest.c                   |    6 +-
 tests/nodeinfotest.c                         |   20 +-
 tests/nwfilterxml2xmltest.c                  |    4 +-
 tests/openvzutilstest.c                      |   12 +-
 tests/qemuargv2xmltest.c                     |   12 +-
 tests/qemuhelptest.c                         |   20 +-
 tests/qemuxml2argvtest.c                     |   38 +-
 tests/qemuxml2xmltest.c                      |   10 +-
 tests/qparamtest.c                           |    8 +-
 tests/seclabeltest.c                         |   24 +-
 tests/sexpr2xmltest.c                        |  116 +-
 tests/sockettest.c                           |    8 +-
 tests/ssh.c                                  |    6 +-
 tests/statstest.c                            |   14 +-
 tests/storagepoolxml2xmltest.c               |    8 +-
 tests/storagevolxml2xmltest.c                |    8 +-
 tests/testutils.c                            |   67 +-
 tests/testutilsxen.c                         |    2 +-
 tests/utiltest.c                             |   14 +-
 tests/virbuftest.c                           |    2 +-
 tests/virnetmessagetest.c                    |    4 +-
 tests/virnetsockettest.c                     |   18 +-
 tests/virshtest.c                            |  134 ++--
 tests/vmx2xmltest.c                          |   32 +-
 tests/xencapstest.c                          |  166 ++--
 tests/xmconfigtest.c                         |    6 +-
 tests/xml2sexprtest.c                        |   52 +-
 tests/xml2vmxtest.c                          |   34 +-
 uncrustify.cfg                               | 1161 ++++++++++++++++++++
 277 files changed, 13209 insertions(+), 11534 deletions(-)
 create mode 100644 uncrustify.cfg

uncrustify works pretty well, but ~3000 lines of the diff are due to
false positives where uncrustify changes the style (but shouldn't)
because I'm not finished with tweaking uncrustify yet.

You can find this commit at
https://gitorious.org/~photron/libvirt/photron-libvirt/commits/uncrustify
as 94f7a6bff55df82d28a39a2782112f7b08e75f5d.

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list