|
|
9119d9 |
From c5440555656b0e7bd784437ab905e53f0a25542b Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <c5440555656b0e7bd784437ab905e53f0a25542b@dist-git>
|
|
|
9119d9 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
9119d9 |
Date: Wed, 24 Sep 2014 16:55:43 +0200
|
|
|
9119d9 |
Subject: [PATCH] conf: remove redundant local variable
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1139364
|
|
|
9119d9 |
|
|
|
9119d9 |
Use just one int variable for all the FromString calls.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit 0ece766bd2f3627ad53c418e23d078127b9fbc26)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/conf/domain_conf.c | 27 +++++++++++----------------
|
|
|
9119d9 |
1 file changed, 11 insertions(+), 16 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
9119d9 |
index 306843b..a4db3c3 100644
|
|
|
9119d9 |
--- a/src/conf/domain_conf.c
|
|
|
9119d9 |
+++ b/src/conf/domain_conf.c
|
|
|
9119d9 |
@@ -6905,7 +6905,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
virNWFilterHashTablePtr filterparams = NULL;
|
|
|
9119d9 |
virDomainActualNetDefPtr actual = NULL;
|
|
|
9119d9 |
xmlNodePtr oldnode = ctxt->node;
|
|
|
9119d9 |
- int ret;
|
|
|
9119d9 |
+ int ret, val;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (VIR_ALLOC(def) < 0)
|
|
|
9119d9 |
return NULL;
|
|
|
9119d9 |
@@ -7252,13 +7252,12 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if (mode != NULL) {
|
|
|
9119d9 |
- int m;
|
|
|
9119d9 |
- if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
|
|
|
9119d9 |
+ if ((val = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
|
|
|
9119d9 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
9119d9 |
_("Unknown mode has been specified"));
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- def->data.direct.mode = m;
|
|
|
9119d9 |
+ def->data.direct.mode = val;
|
|
|
9119d9 |
} else {
|
|
|
9119d9 |
def->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_VEPA;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
@@ -7333,31 +7332,28 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
|
|
|
9119d9 |
STREQ_NULLABLE(def->model, "virtio")) {
|
|
|
9119d9 |
if (backend != NULL) {
|
|
|
9119d9 |
- int name;
|
|
|
9119d9 |
- if ((name = virDomainNetBackendTypeFromString(backend)) < 0 ||
|
|
|
9119d9 |
- name == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
|
|
|
9119d9 |
+ if ((val = virDomainNetBackendTypeFromString(backend)) < 0 ||
|
|
|
9119d9 |
+ val == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
|
|
|
9119d9 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
_("Unknown interface <driver name='%s'> "
|
|
|
9119d9 |
"has been specified"),
|
|
|
9119d9 |
backend);
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- def->driver.virtio.name = name;
|
|
|
9119d9 |
+ def->driver.virtio.name = val;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (txmode != NULL) {
|
|
|
9119d9 |
- int m;
|
|
|
9119d9 |
- if ((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0 ||
|
|
|
9119d9 |
- m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
|
|
|
9119d9 |
+ if ((val = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0 ||
|
|
|
9119d9 |
+ val == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
|
|
|
9119d9 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
_("Unknown interface <driver txmode='%s'> "
|
|
|
9119d9 |
"has been specified"),
|
|
|
9119d9 |
txmode);
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- def->driver.virtio.txmode = m;
|
|
|
9119d9 |
+ def->driver.virtio.txmode = val;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (ioeventfd) {
|
|
|
9119d9 |
- int val;
|
|
|
9119d9 |
if ((val = virTristateSwitchTypeFromString(ioeventfd)) <= 0) {
|
|
|
9119d9 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
_("unknown interface ioeventfd mode '%s'"),
|
|
|
9119d9 |
@@ -7367,14 +7363,13 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
def->driver.virtio.ioeventfd = val;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (event_idx) {
|
|
|
9119d9 |
- int idx;
|
|
|
9119d9 |
- if ((idx = virTristateSwitchTypeFromString(event_idx)) <= 0) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(event_idx)) <= 0) {
|
|
|
9119d9 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
_("unknown interface event_idx mode '%s'"),
|
|
|
9119d9 |
event_idx);
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- def->driver.virtio.event_idx = idx;
|
|
|
9119d9 |
+ def->driver.virtio.event_idx = val;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (queues) {
|
|
|
9119d9 |
unsigned int q;
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.1
|
|
|
9119d9 |
|