[libvirt] [PATCH 1/3] xenXMDomainConfigParse: avoid dead store

Jim Meyering jim at meyering.net
Fri Mar 5 17:27:18 UTC 2010


Here are three dead-store removals:

>From f0645665521b07febb86f05778ca354126f01179 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 5 Mar 2010 16:15:09 +0100
Subject: [PATCH 1/3] xenXMDomainConfigParse: avoid dead store

* src/xen/xm_internal.c (xenXMDomainConfigParse): Avoid dead store
to local, "data".  Remove declaration, too.
---
 src/xen/xm_internal.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 014cbfc..3710dcb 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1,7 +1,7 @@
 /*
  * xm_internal.h: helper routines for dealing with inactive domains
  *
- * Copyright (C) 2006-2007, 2009 Red Hat
+ * Copyright (C) 2006-2007, 2009, 2010 Red Hat
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -1367,7 +1367,6 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
                 graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;

             while (key) {
-                char *data;
                 char *nextkey = strchr(key, ',');
                 char *end = nextkey;
                 if (nextkey) {
@@ -1375,7 +1374,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
                     nextkey++;
                 }

-                if (!(data = strchr(key, '=')))
+                if (!strchr(key, '='))
                     break;

                 if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
--
1.7.0.1.300.gd855a


>From 78b1bea3186255891e48ddae1c822e21c5ff10db Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 5 Mar 2010 16:18:47 +0100
Subject: [PATCH 2/3] virInterfaceDefParseBond: avoid dead stores

* src/conf/interface_conf.c (virInterfaceDefParseBond): Avoid dead stores
to local, "node".  Remove declaration, too.
---
 src/conf/interface_conf.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index a0d2dfa..f60b36a 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -570,7 +570,6 @@ error:
 static int
 virInterfaceDefParseBond(virInterfaceDefPtr def,
                          xmlXPathContextPtr ctxt) {
-    xmlNodePtr node;
     int ret = -1;
     unsigned long tmp;

@@ -582,8 +581,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
     if (ret != 0)
        goto error;

-    node = virXPathNode("./miimon[1]", ctxt);
-    if (node != NULL) {
+    if (virXPathNode("./miimon[1]", ctxt) != NULL) {
         def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_MII;

         ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp);
@@ -618,7 +616,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
             goto error;
         }

-    } else if ((node = virXPathNode("./arpmon[1]", ctxt)) != NULL) {
+    } else if (virXPathNode("./arpmon[1]", ctxt) != NULL) {

         def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_ARP;

--
1.7.0.1.300.gd855a


>From 197167ec109b2e69ad2a6a43d02f54dee457c120 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 5 Mar 2010 17:36:40 +0100
Subject: [PATCH 3/3] ebtablesAddRemoveRule: avoid dead store

* src/util/ebtables.c (ebtablesAddRemoveRule): Avoid dead store
to local, "s".
---
 src/util/ebtables.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/ebtables.c b/src/util/ebtables.c
index dba9f82..988783c 100644
--- a/src/util/ebtables.c
+++ b/src/util/ebtables.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 IBM Corp.
- * Copyright (C) 2007-2009 Red Hat, Inc.
+ * Copyright (C) 2007-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -185,7 +185,7 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...)
         1;  /*   arg           */

     va_start(args, arg);
-    while ((s = va_arg(args, const char *)))
+    while (va_arg(args, const char *))
         n++;

     va_end(args);
--
1.7.0.1.300.gd855a




More information about the libvir-list mailing list