[PATCH 03/14] conf: disk: Avoid temporary variable when parsing driver name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/conf/domain_conf.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 43a90a3..21a904d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6919,7 +6919,6 @@ static int
 virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
                                xmlNodePtr cur)
 {
-    char *driverName = NULL;
     char *driverType = NULL;
     char *cachetag = NULL;
     char *error_policy = NULL;
@@ -6932,7 +6931,7 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
     char *driverIOThread = NULL;
     int ret = -1;

-    driverName = virXMLPropString(cur, "name");
+    def->src->driverName = virXMLPropString(cur, "name");
     driverType = virXMLPropString(cur, "type");
     if (STREQ_NULLABLE(driverType, "aio")) {
         /* In-place conversion to "raw", for Xen back-compat */
@@ -6950,9 +6949,6 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
     discard = virXMLPropString(cur, "discard");
     driverIOThread = virXMLPropString(cur, "iothread");

-    def->src->driverName = driverName;
-    driverName = NULL;
-
     if (cachetag &&
         (def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -7051,7 +7047,6 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,

  cleanup:
     VIR_FREE(driverType);
-    VIR_FREE(driverName);
     VIR_FREE(cachetag);
     VIR_FREE(error_policy);
     VIR_FREE(rerror_policy);
-- 
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]