]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Remove @name in virStoragePoolDefParseSource
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 12:04:42 +0000 (07:04 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 13:51:23 +0000 (08:51 -0500)
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>
src/conf/storage_conf.c

index 177ea63076a69219e521ff1874cb5e59ecb80be0..58c28a2d57917006467d7807973423c06d44d746 100644 (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) {