]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lib: Drop intermediary return variables
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Oct 2021 08:56:01 +0000 (10:56 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Oct 2021 10:48:46 +0000 (12:48 +0200)
commit857df2fe50a5f3ad1a4f040de648b1da4a0ab6db
treed6ec06937d9a534736f24f86fc5a1c9b4fd66a00
parent945942ebba943e6addd6c8163d6e38a4a7df7b8f
lib: Drop intermediary return variables

In a few places we declare a variable (which is optionally
followed by a code not touching it) then set the variable to a
value and return the variable immediately. It's obvious that the
variable is needless and the value can be returned directly
instead.

This patch was generated using this semantic patch:

  @@
  type T;
  identifier ret;
  expression E;
  @@
  - T ret;
  ... when != ret
      when strict
  - ret = E;
  - return ret;
  + return E;

After that I fixed couple of formatting issues because coccinelle
formatted some lines differently than our coding style.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
34 files changed:
src/bhyve/bhyve_domain.c
src/conf/domain_addr.c
src/conf/domain_conf.c
src/conf/virnetworkobj.c
src/conf/virnwfilterbindingobj.c
src/conf/virnwfilterobj.c
src/esx/esx_driver.c
src/esx/esx_storage_backend_iscsi.c
src/esx/esx_storage_backend_vmfs.c
src/hyperv/hyperv_driver.c
src/locking/lock_daemon.c
src/locking/lock_driver_sanlock.c
src/logging/log_daemon.c
src/network/bridge_driver.c
src/qemu/qemu_alias.c
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_monitor.c
src/security/security_apparmor.c
src/security/security_nop.c
src/test/test_driver.c
src/util/viraudit.c
src/util/virfirewall.c
src/util/virmacmap.c
src/util/virnetdev.c
src/util/virpci.c
src/vbox/vbox_common.c
tests/bhyvexml2argvmock.c
tests/qemumonitortestutils.c
tests/qemusecuritymock.c
tests/qemuxml2argvmock.c
tests/virnetserverclienttest.c
tests/virpcimock.c
tests/virusbmock.c