[PATCH v1 30/37] Adapt to VIR_ALLOC and virAsprintf in src/vmware/*

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

 



---
 src/vmware/vmware_conf.c   | 33 +++++++--------------------------
 src/vmware/vmware_driver.c |  4 +---
 2 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 9d3d37e..b6d20ea 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -77,10 +77,8 @@ vmwareCapsInit(void)
                                       NULL, NULL, 0, NULL) == NULL)
         goto error;
 
-    if (VIR_ALLOC(cpu) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cpu) < 0)
         goto error;
-    }
 
     if (!(cpu->arch = caps->host.arch)) {
         virReportOOMError();
@@ -315,18 +313,9 @@ error:
 int
 vmwareConstructVmxPath(char *directoryName, char *name, char **vmxPath)
 {
-    if (directoryName != NULL) {
-        if (virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name) < 0) {
-            virReportOOMError();
-            return -1;
-        }
-    } else {
-        if (virAsprintf(vmxPath, "%s.vmx", name) < 0) {
-            virReportOOMError();
-            return -1;
-        }
-    }
-    return 0;
+    if (directoryName != NULL)
+        return virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name);
+    return virAsprintf(vmxPath, "%s.vmx", name);
 }
 
 int
@@ -385,10 +374,8 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
         goto cleanup;
     }
 
-    if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0) {
-        virReportOOMError();
+    if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0)
         goto cleanup;
-    }
 
     ret = 0;
 
@@ -427,11 +414,7 @@ vmwareMoveFile(char *srcFile, char *dstFile)
 int
 vmwareMakePath(char *srcDir, char *srcName, char *srcExt, char **outpath)
 {
-    if (virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-    return 0;
+    return virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt);
 }
 
 int
@@ -448,10 +431,8 @@ vmwareExtractPid(const char * vmxPath)
         goto cleanup;
 
     if (virAsprintf(&logFilePath, "%s/vmware.log",
-                    vmxDir) < 0) {
-        virReportOOMError();
+                    vmxDir) < 0)
         goto cleanup;
-    }
 
     if ((logFile = fopen(logFilePath, "r")) == NULL)
         goto cleanup;
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index ca6615f..988552f 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -126,10 +126,8 @@ vmwareConnectOpen(virConnectPtr conn,
         VIR_FREE(vmrun);
     }
 
-    if (VIR_ALLOC(driver) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(driver) < 0)
         return VIR_DRV_OPEN_ERROR;
-    }
 
     if (virMutexInit(&driver->lock) < 0)
         goto cleanup;
-- 
1.8.1.5

--
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]