[libvirt] [PATCH] Remove unused variables.

John Ferlan jferlan at redhat.com
Fri Sep 25 20:13:35 UTC 2015



On 09/24/2015 03:35 AM, Martin Kletzander wrote:
> I was playing with coccinelle tool the other day and just for the fun of
> it, I tried removing some useless things from our code.  And look what
> came up.  No functional change, and we're down in the number of lines by
> about a hundred.
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  daemon/remote.c                           |  5 +---
>  src/bhyve/bhyve_driver.c                  | 38 +++++++++++--------------------
>  src/conf/storage_conf.c                   |  9 +++-----
>  src/libxl/libxl_driver.c                  | 36 ++++++++++-------------------
>  src/lxc/lxc_driver.c                      | 36 ++++++++++-------------------
>  src/lxc/lxc_native.c                      |  5 +---
>  src/network/bridge_driver.c               | 38 +++++++++----------------------
>  src/nwfilter/nwfilter_ebiptables_driver.c | 21 ++++++++---------
>  src/qemu/qemu_command.c                   | 19 ++++++----------
>  src/qemu/qemu_driver.c                    | 14 ++++--------
>  src/qemu/qemu_migration.c                 |  9 +++-----
>  src/qemu/qemu_process.c                   | 18 ++++-----------
>  src/storage/storage_backend_iscsi.c       |  5 +---
>  src/test/test_driver.c                    | 30 ++++++++----------------
>  src/util/virdbus.c                        |  5 +---
>  src/util/virfile.c                        |  4 +---
>  src/util/virhashcode.c                    |  4 +---
>  src/util/virstoragefile.c                 |  1 -
>  src/vbox/vbox_storage.c                   |  8 ++-----
>  src/vz/vz_network.c                       | 24 +++++++------------
>  src/xen/xen_hypervisor.c                  |  5 +---
>  src/xen/xend_internal.c                   |  6 +----
>  22 files changed, 107 insertions(+), 233 deletions(-)
> 

I agree with Andrea about the personal coding style dislike of "return
some function(lots of args);

A good compiler will optimize things anyway, but personal preferences
aside - I looked through the changes and they seem to be OK... so even
though you're messing up the bugs per KLOC metrics ;-)....

ACK,

John

Could have done the "return foo(conn->privateData->{domains|networks}"
and saved a few more electrons.






More information about the libvir-list mailing list