[libvirt] [PATCH v2 00/22] Remove unnecessary curly brackets around one-line bodies
John Ferlan
jferlan at redhat.com
Thu Nov 13 23:52:18 UTC 2014
On 11/13/2014 09:37 AM, Martin Kletzander wrote:
> Brackets were removed by the following script in the root directory of
> libvirt's repository:
>
> for i in $(git ls-files | grep '\.[ch]$'); do
> echo -n "$i ... ";
> emacs $i --batch --eval \
> '(replace-regexp "^\\([[:space:]]*\\(if\\|for\\|while\\).*)\\)[[:space:]]*{\\(\n[^\n;]*;[^\n;]*\\)\n[[:space:]]*}$" "\\1\\3" nil (point-min) (point-max))' \
> -f save-buffer &>/dev/null;
> echo done;
> done
>
> v2:
> - Smaller patches, so there has to be none allowed through by
> moderators
> - Only curly brackets around one-line bodies with one-line preceding
> conditions removed
> - syntax-check! (with some other bracket-spacing.pl cleanups
>
ACK series in general - although something needs to be done about 17/22
and the comment in 22/22 probably needs an adjustment as well as a way
hopefully to indicate what rule is being violated.
I've scanned each of the changes looking for a similar MACRO issue -
most #define macros are capitalized so it's fairly easy to spot
(although the old eyes did get weary of looking at all the changes
here). There are a few though (like testError()) that don't follow the
upcase, so I'm not sure if I missed anything.
It's too bad there isn't a way to find current existing usages where all
that's on the between the { && } is a reserved word like goto, return,
break, continue... Perhaps the VIR_ macros, auto incr/decr, etc. Then
see what's left over in order to make sure we're not hitting any
"hidden" macro type case.
John
> Martin Kletzander (22):
> virt-aa-helper: Trick invalid syntax-check
> Remove unnecessary curly brackets in daemon/ and examples/
> Remove unnecessary curly brackets in src/esx/esx_driver.c
> Remove unnecessary curly brackets in rest of src/esx/
> Remove unnecessary curly brackets in src/vmx/vmx.c
> Remove unnecessary curly brackets in src/conf/
> Remove unnecessary curly brackets in src/hyperv/
> Remove unnecessary curly brackets in src/node_device/
> Remove unnecessary curly brackets in src/qemu/
> Remove unnecessary curly brackets in src/storage/
> Remove unnecessary curly brackets in src/test/test_driver.c
> Remove unnecessary curly brackets in src/util/
> Remove unnecessary curly brackets in src/vbox/
> Remove unnecessary curly brackets in rest of src/[a-n]*/
> Remove unnecessary curly brackets in rest of src/[o-u]*/
> Remove unnecessary curly brackets in rest of src/
> Remove unnecessary curly brackets in tools/
> Remove unnecessary curly brackets in tests/
> docs: Adjust contributor guidelines about curly brackets
> bracket-spacing: Don't modify current line
> bracket-spacing: Remove pointless cycles
> bracket-spacing: Add syntax-check for unnecessary curly brackets
>
> HACKING | 8 +-
> build-aux/bracket-spacing.pl | 74 ++++--
> daemon/libvirtd.c | 15 +-
> daemon/remote.c | 12 +-
> docs/hacking.html.in | 4 +-
> examples/object-events/event-test.c | 3 +-
> examples/openauth/openauth.c | 9 +-
> src/access/viraccessdriverstack.c | 3 +-
> src/bhyve/bhyve_driver.c | 3 +-
> src/conf/capabilities.c | 3 +-
> src/conf/domain_conf.c | 135 ++++-------
> src/conf/interface_conf.c | 9 +-
> src/conf/network_conf.c | 51 ++--
> src/conf/node_device_conf.c | 15 +-
> src/conf/nwfilter_conf.c | 12 +-
> src/conf/object_event.c | 6 +-
> src/conf/storage_conf.c | 24 +-
> src/datatypes.c | 6 +-
> src/driver.c | 3 +-
> src/esx/esx_device_monitor.c | 3 +-
> src/esx/esx_driver.c | 390 ++++++++++--------------------
> src/esx/esx_interface_driver.c | 12 +-
> src/esx/esx_network_driver.c | 57 ++---
> src/esx/esx_nwfilter_driver.c | 3 +-
> src/esx/esx_secret_driver.c | 3 +-
> src/esx/esx_storage_backend_iscsi.c | 45 ++--
> src/esx/esx_storage_backend_vmfs.c | 51 ++--
> src/esx/esx_storage_driver.c | 81 +++----
> src/esx/esx_util.c | 45 ++--
> src/esx/esx_vi.c | 249 +++++++------------
> src/esx/esx_vi_types.c | 45 ++--
> src/hyperv/hyperv_device_monitor.c | 3 +-
> src/hyperv/hyperv_driver.c | 87 +++----
> src/hyperv/hyperv_interface_driver.c | 3 +-
> src/hyperv/hyperv_network_driver.c | 3 +-
> src/hyperv/hyperv_nwfilter_driver.c | 3 +-
> src/hyperv/hyperv_secret_driver.c | 3 +-
> src/hyperv/hyperv_storage_driver.c | 3 +-
> src/hyperv/hyperv_util.c | 6 +-
> src/hyperv/hyperv_wmi.c | 39 +--
> src/interface/interface_backend_udev.c | 12 +-
> src/libvirt-lxc.c | 3 +-
> src/libvirt-nodedev.c | 3 +-
> src/libvirt-storage.c | 6 +-
> src/libxl/libxl_driver.c | 12 +-
> src/locking/lock_daemon.c | 3 +-
> src/locking/lock_driver_sanlock.c | 6 +-
> src/lxc/lxc_container.c | 9 +-
> src/lxc/lxc_driver.c | 9 +-
> src/lxc/lxc_process.c | 6 +-
> src/network/bridge_driver.c | 6 +-
> src/network/bridge_driver_linux.c | 3 +-
> src/node_device/node_device_driver.c | 21 +-
> src/node_device/node_device_hal.c | 6 +-
> src/node_device/node_device_udev.c | 87 +++----
> src/nwfilter/nwfilter_dhcpsnoop.c | 3 +-
> src/nwfilter/nwfilter_ebiptables_driver.c | 12 +-
> src/nwfilter/nwfilter_gentech_driver.c | 9 +-
> src/nwfilter/nwfilter_learnipaddr.c | 3 +-
> src/openvz/openvz_conf.c | 3 +-
> src/openvz/openvz_driver.c | 27 +--
> src/phyp/phyp_driver.c | 21 +-
> src/qemu/qemu_agent.c | 3 +-
> src/qemu/qemu_capabilities.c | 9 +-
> src/qemu/qemu_cgroup.c | 6 +-
> src/qemu/qemu_command.c | 6 +-
> src/qemu/qemu_conf.c | 3 +-
> src/qemu/qemu_domain.c | 3 +-
> src/qemu/qemu_driver.c | 45 ++--
> src/qemu/qemu_hotplug.c | 6 +-
> src/qemu/qemu_migration.c | 3 +-
> src/qemu/qemu_monitor_json.c | 12 +-
> src/qemu/qemu_monitor_text.c | 6 +-
> src/qemu/qemu_process.c | 18 +-
> src/remote/remote_driver.c | 3 +-
> src/rpc/virnetclient.c | 9 +-
> src/rpc/virnetserver.c | 3 +-
> src/rpc/virnetserverclient.c | 3 +-
> src/rpc/virnetserverservice.c | 3 +-
> src/security/security_manager.c | 3 +-
> src/security/virt-aa-helper.c | 9 +-
> src/storage/parthelper.c | 3 +-
> src/storage/storage_backend.c | 9 +-
> src/storage/storage_backend_disk.c | 15 +-
> src/storage/storage_backend_fs.c | 6 +-
> src/storage/storage_backend_mpath.c | 27 +--
> src/storage/storage_backend_rbd.c | 30 +--
> src/storage/storage_backend_scsi.c | 6 +-
> src/storage/storage_driver.c | 9 +-
> src/test/test_driver.c | 57 ++---
> src/uml/uml_conf.c | 6 +-
> src/uml/uml_driver.c | 9 +-
> src/util/virauth.c | 12 +-
> src/util/virbitmap.c | 6 +-
> src/util/virbuffer.c | 3 +-
> src/util/vircommand.c | 9 +-
> src/util/virconf.c | 15 +-
> src/util/virdbus.c | 3 +-
> src/util/virdnsmasq.c | 3 +-
> src/util/vireventpoll.c | 9 +-
> src/util/virfile.c | 6 +-
> src/util/virfirewall.c | 6 +-
> src/util/viriscsi.c | 9 +-
> src/util/virlockspace.c | 6 +-
> src/util/virlog.c | 3 +-
> src/util/virnetdev.c | 6 +-
> src/util/virnetdevbridge.c | 3 +-
> src/util/virnetdevmacvlan.c | 9 +-
> src/util/virnetdevtap.c | 6 +-
> src/util/virpci.c | 15 +-
> src/util/virsexpr.c | 24 +-
> src/util/virstorageencryption.c | 3 +-
> src/util/virstoragefile.c | 6 +-
> src/util/virsysinfo.c | 3 +-
> src/util/virthreadpool.c | 3 +-
> src/util/virutil.c | 9 +-
> src/util/virxml.c | 18 +-
> src/vbox/vbox_MSCOMGlue.c | 30 +--
> src/vbox/vbox_XPCOMCGlue.c | 33 +--
> src/vbox/vbox_common.c | 51 ++--
> src/vbox/vbox_network.c | 15 +-
> src/vbox/vbox_snapshot_conf.c | 21 +-
> src/vbox/vbox_storage.c | 30 +--
> src/vbox/vbox_tmpl.c | 30 +--
> src/vmware/vmware_conf.c | 3 +-
> src/vmware/vmware_driver.c | 6 +-
> src/vmx/vmx.c | 243 +++++++------------
> src/xen/block_stats.c | 3 +-
> src/xen/xen_driver.c | 6 +-
> src/xen/xen_hypervisor.c | 6 +-
> src/xen/xend_internal.c | 18 +-
> src/xen/xm_internal.c | 6 +-
> src/xenapi/xenapi_driver.c | 12 +-
> src/xenapi/xenapi_utils.c | 9 +-
> src/xenconfig/xen_common.c | 6 +-
> src/xenconfig/xen_sxpr.c | 6 +-
> tests/commandhelper.c | 3 +-
> tests/esxutilstest.c | 12 +-
> tests/eventtest.c | 3 +-
> tests/openvzutilstest.c | 6 +-
> tests/securityselinuxlabeltest.c | 6 +-
> tests/shunloadtest.c | 6 +-
> tests/utiltest.c | 3 +-
> tests/virbuftest.c | 3 +-
> tests/virhashtest.c | 30 +--
> tests/virtimetest.c | 3 +-
> tests/vmx2xmltest.c | 12 +-
> tests/xml2vmxtest.c | 27 +--
> tools/virsh-console.c | 6 +-
> tools/virsh-domain.c | 27 +--
> tools/virsh-edit.c | 6 +-
> tools/virsh-host.c | 3 +-
> tools/virsh-pool.c | 6 +-
> tools/virsh-volume.c | 12 +-
> tools/virsh.c | 18 +-
> tools/wireshark/src/packet-libvirt.c | 6 +-
> 156 files changed, 1050 insertions(+), 2006 deletions(-)
>
> --
> 2.1.3
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
More information about the libvir-list
mailing list