[libvirt] address 3 more dead stores
Daniel Veillard
veillard at redhat.com
Fri Sep 4 16:38:28 UTC 2009
On Fri, Sep 04, 2009 at 11:22:28AM +0200, Jim Meyering wrote:
> These changes fix two dead stores and add a comment suggesting
> why *not* to remove the third one.
>
> >From 41c778fdbaef9abf52bc4c3e278d3389d8198c34 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Fri, 4 Sep 2009 10:55:55 +0200
> Subject: [PATCH 1/3] interface_conf.c: remove a dead-store and declaration
>
> * src/interface_conf.c (virInterfaceDefParseDhcp): Remove unused "old".
> ---
> src/interface_conf.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/src/interface_conf.c b/src/interface_conf.c
> index a74d17e..96e0710 100644
> --- a/src/interface_conf.c
> +++ b/src/interface_conf.c
> @@ -228,11 +228,9 @@ static int
> virInterfaceDefParseDhcp(virConnectPtr conn, virInterfaceDefPtr def,
> xmlNodePtr dhcp, xmlXPathContextPtr ctxt) {
> char *tmp;
> - xmlNodePtr old;
> int ret = 0;
>
> def->proto.dhcp = 1;
> - old = ctxt->node;
> ctxt->node = dhcp;
> /* Not much to do in the current version */
> tmp = virXPathString(conn, "string(./@peerdns)", ctxt);
> --
> 1.6.4.2.409.g85dc3
ACK, trivial
>
> >From 10037ca58c8d93e427c480082704e7dd52424525 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Fri, 4 Sep 2009 11:01:00 +0200
> Subject: [PATCH 2/3] hash.c: remove a dead store
>
> * src/hash.c (virHashFree): Remove useless assignment to inside_table.
> ---
> src/hash.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/src/hash.c b/src/hash.c
> index 9308c0c..45c5747 100644
> --- a/src/hash.c
> +++ b/src/hash.c
> @@ -231,7 +231,6 @@ virHashFree(virHashTablePtr table, virHashDeallocator f)
> inside_table = 0;
> iter = next;
> }
> - inside_table = 0;
> }
> VIR_FREE(table->table);
> }
> --
> 1.6.4.2.409.g85dc3
That one is actually not trivial, but right, it's not needed in that
case. It will probably show up in libxml2 reports too !
>
> >From 3b16e6d50d364a5307284a78a7b23d8631146663 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Fri, 4 Sep 2009 11:20:23 +0200
> Subject: [PATCH 3/3] qemu_conf.c: add a comment suggesting why we leave a dead-store
>
> * src/qemu_conf.c (qemuBuildHostNetStr): Do not remove the type_sep=','
> dead store, since not having it would be a problem if we ever add a
> new attribute=VAL option.
> ---
> src/qemu_conf.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
> index 2c4a37d..6ffca2f 100644
> --- a/src/qemu_conf.c
> +++ b/src/qemu_conf.c
> @@ -1269,7 +1269,7 @@ qemuBuildHostNetStr(virConnectPtr conn,
> if (net->hostnet_name) {
> virBufferVSprintf(&buf, "%cname=%s", type_sep,
> net->hostnet_name);
> - type_sep = ',';
> + type_sep = ','; /* dead-store, but leave it, in case... */
> }
> if (virBufferError(&buf)) {
> virReportOOMError(conn);
ACK
thanks !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list