conf: Remove @name in virStoragePoolDefParseSource

Remove the need for the @name variable by directly assigning
into source->hosts[i].name.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
John Ferlan 2019-02-12 07:04:42 -05:00
parent e96c47516c
commit c75e615d3e

View File

@ -458,7 +458,6 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
int nsource;
size_t i;
virStoragePoolOptionsPtr options;
char *name = NULL;
char *port = NULL;
char *ver = NULL;
int n;
@ -502,13 +501,12 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
source->nhost = n;
for (i = 0; i < source->nhost; i++) {
name = virXMLPropString(nodeset[i], "name");
if (name == NULL) {
source->hosts[i].name = virXMLPropString(nodeset[i], "name");
if (!source->hosts[i].name) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing storage pool host name"));
goto cleanup;
}
source->hosts[i].name = name;
port = virXMLPropString(nodeset[i], "port");
if (port) {