[PATCH] lib: Drop intermediary return variables
Ján Tomko
jtomko at redhat.com
Mon Oct 25 10:47:57 UTC 2021
On a Friday in 2021, Michal Privoznik wrote:
>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 at redhat.com>
>---
> src/bhyve/bhyve_domain.c | 6 +-----
> src/conf/domain_addr.c | 6 +-----
> src/conf/domain_conf.c | 5 +----
> src/conf/virnetworkobj.c | 4 +---
> src/conf/virnwfilterbindingobj.c | 5 +----
> src/conf/virnwfilterobj.c | 5 +----
> src/esx/esx_driver.c | 5 +----
> src/esx/esx_storage_backend_iscsi.c | 5 +----
> src/esx/esx_storage_backend_vmfs.c | 5 +----
> src/hyperv/hyperv_driver.c | 5 +----
> src/locking/lock_daemon.c | 5 +----
> src/locking/lock_driver_sanlock.c | 6 ++----
> src/logging/log_daemon.c | 5 +----
> src/network/bridge_driver.c | 27 +++++----------------------
> src/qemu/qemu_alias.c | 24 ++++--------------------
> src/qemu/qemu_command.c | 15 ++++++---------
> src/qemu/qemu_domain.c | 10 +++-------
> src/qemu/qemu_monitor.c | 5 +----
> src/security/security_apparmor.c | 5 +----
> src/security/security_nop.c | 5 +----
> src/test/test_driver.c | 9 ++-------
> src/util/viraudit.c | 4 +---
> src/util/virfirewall.c | 6 +-----
> src/util/virmacmap.c | 6 +-----
> src/util/virnetdev.c | 5 +----
> src/util/virpci.c | 10 ++--------
> src/vbox/vbox_common.c | 7 +++----
> tests/bhyvexml2argvmock.c | 5 +----
> tests/qemumonitortestutils.c | 5 +----
> tests/qemusecuritymock.c | 6 +-----
> tests/qemuxml2argvmock.c | 5 +----
> tests/virnetserverclienttest.c | 6 +-----
> tests/virpcimock.c | 8 ++------
> tests/virusbmock.c | 4 +---
> 34 files changed, 54 insertions(+), 190 deletions(-)
>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20211025/6192a4ce/attachment-0001.sig>
More information about the libvir-list
mailing list