On Mon, Sep 07, 2009 at 05:39:31PM +0200, Jim Meyering wrote:
>From 129dc57243df4e73daa24aac671087bcd25f51ad Mon Sep 17 00:00:00
2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 16:49:37 +0200
Subject: [PATCH 1/6] xm_internal.c: remove dead stores of local, "type"
* src/xm_internal.c (xenXMDomainConfigParse): Remove declaration
and useless containing if-block, too.
---
src/xm_internal.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 9627ffb..661172b 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1,7 +1,7 @@
/*
* xm_internal.h: helper routines for dealing with inactive domains
*
- * Copyright (C) 2006-2007 Red Hat
+ * Copyright (C) 2006-2007, 2009 Red Hat
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -995,7 +995,6 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (list && list->type == VIR_CONF_LIST) {
list = list->list;
while (list) {
- int type = -1;
char script[PATH_MAX];
char model[10];
char ip[16];
@@ -1031,7 +1030,6 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
mac[len] = '\0';
} else if (STRPREFIX(key, "bridge=")) {
int len = nextkey ? (nextkey - data) : sizeof(bridge)-1;
- type = 1;
if (len > (sizeof(bridge)-1))
len = sizeof(bridge)-1;
strncpy(bridge, data, len);
@@ -1069,11 +1067,6 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
key = nextkey;
}
- /* XXX Forcing to pretend its a bridge */
- if (type == -1) {
- type = 1;
- }
-
if (VIR_ALLOC(net) < 0)
goto cleanup;
--
1.6.4.2.419.gab238
>From b8b1ea4894ac9bf2a59472958a8bb0749526847f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 17:22:19 +0200
Subject: [PATCH 2/6] xm_internal.c: remove two ret=... dead stores
* src/xm_internal.c (xenXMDomainCreate): Remove dead stores.
---
src/xm_internal.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 661172b..de3aca9 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1850,10 +1850,10 @@ int xenXMDomainCreate(virDomainPtr domain) {
goto error;
domain->id = ret;
- if ((ret = xend_wait_for_devices(domain->conn, domain->name)) < 0)
+ if (xend_wait_for_devices(domain->conn, domain->name) < 0)
goto error;
- if ((ret = xenDaemonDomainResume(domain)) < 0)
+ if (xenDaemonDomainResume(domain) < 0)
goto error;
xenUnifiedUnlock(priv);
--
1.6.4.2.419.gab238
>From a74d747d27bde38ece90df9a14acb648d83b9993 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 17:27:34 +0200
Subject: [PATCH 3/6] domain_conf.c: remove two dead stores
* src/domain_conf.c (virDomainSaveXML): Remove use and decl of "err".
(virDomainDefParseXML): Likewise.
---
src/domain_conf.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 8dde5dd..050cf50 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -2520,8 +2520,7 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
/* Extract domain uuid */
tmp = virXPathString(conn, "string(./uuid[1])", ctxt);
if (!tmp) {
- int err;
- if ((err = virUUIDGenerate(def->uuid))) {
+ if (virUUIDGenerate(def->uuid)) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to generate
UUID"));
goto error;
@@ -4456,12 +4455,11 @@ int virDomainSaveXML(virConnectPtr conn,
char *configFile = NULL;
int fd = -1, ret = -1;
size_t towrite;
- int err;
if ((configFile = virDomainConfigFile(conn, configDir, def->name)) == NULL)
goto cleanup;
- if ((err = virFileMakePath(configDir))) {
+ if (virFileMakePath(configDir)) {
virReportSystemError(conn, errno,
_("cannot create config directory
'%s'"),
configDir);
--
1.6.4.2.419.gab238
>From b9c2d697d732b4c740fd9e1f87ad135c52e02c34 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 18:53:20 +0200
Subject: [PATCH 4/6] util.c: avoid dead store to "flag"
* src/util.c (virExecDaemonize): Change flag |= VAR to "flag | VAR".
---
src/util.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util.c b/src/util.c
index 2529837..af50028 100644
--- a/src/util.c
+++ b/src/util.c
@@ -663,7 +663,7 @@ int virExecDaemonize(virConnectPtr conn,
ret = virExecWithHook(conn, argv, envp, keepfd, retpid,
infd, outfd, errfd,
- flags |= VIR_EXEC_DAEMON,
+ flags | VIR_EXEC_DAEMON,
hook, data, pidfile);
/* __virExec should have set an error */
--
1.6.4.2.419.gab238
Hum, those 3 look familiar, didn't we ACK them already ? maybe the
last one is a cut'n paste thing it was in a different routine :-)
>From 6470cb9312a13fd018fb83b79e66cb50190b1f4f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 19:36:17 +0200
Subject: [PATCH 5/6] iptables.c: remove dead store to "s"
* src/iptables.c (iptablesAddRemoveRule): Remove dead store.
---
src/iptables.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/iptables.c b/src/iptables.c
index 73b39d1..4562800 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -398,7 +398,7 @@ iptablesAddRemoveRule(iptRules *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);
ACK, guess this was copied when one realized the need for counting
first.
>From 65c10b030fb43d6678be9bd5eeeb326a024d6902 Mon Sep 17 00:00:00
2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 19:37:37 +0200
Subject: [PATCH 6/6] network_driver.c: remove dead store to "err"
* src/network_driver.c (networkSetAutostart): ...and its decl.
---
src/network_driver.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/src/network_driver.c b/src/network_driver.c
index 84910ab..49855bf 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -1428,9 +1428,7 @@ static int networkSetAutostart(virNetworkPtr net,
goto cleanup;
if (autostart) {
- int err;
-
- if ((err = virFileMakePath(driver->networkAutostartDir))) {
+ if (virFileMakePath(driver->networkAutostartDir)) {
virReportSystemError(net->conn, errno,
_("cannot create autostart directory
'%s'"),
driver->networkAutostartDir);
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/