These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/vmware/vmware_conf.c | 31 +++++++++---------------------- src/vmware/vmware_conf.h | 4 ++-- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 8707f842ad..1e836ec7ed 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -275,18 +275,15 @@ vmwareExtractVersion(struct vmware_driver *driver) switch (driver->type) { case VMWARE_DRIVER_PLAYER: - if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmplayer") < 0) - goto cleanup; + virAsprintf(&bin, "%s/%s", vmwarePath, "vmplayer"); break; case VMWARE_DRIVER_WORKSTATION: - if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware") < 0) - goto cleanup; + virAsprintf(&bin, "%s/%s", vmwarePath, "vmware"); break; case VMWARE_DRIVER_FUSION: - if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware-vmx") < 0) - goto cleanup; + virAsprintf(&bin, "%s/%s", vmwarePath, "vmware-vmx"); break; default: @@ -365,19 +362,13 @@ vmwareParsePath(const char *path, char **directory, char **filename) return -1; } -int +void vmwareConstructVmxPath(char *directoryName, char *name, char **vmxPath) { - int ret; - if (directoryName != NULL) - ret = virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name); + virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name); else - ret = virAsprintf(vmxPath, "%s.vmx", name); - - if (ret < 0) - return -1; - return 0; + virAsprintf(vmxPath, "%s.vmx", name); } int @@ -437,8 +428,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) goto cleanup; } - if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0) - goto cleanup; + vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath); ret = 0; @@ -477,8 +467,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) - return -1; + virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt); return 0; } @@ -495,9 +484,7 @@ vmwareExtractPid(const char * vmxPath) if ((vmxDir = mdir_name(vmxPath)) == NULL) goto cleanup; - if (virAsprintf(&logFilePath, "%s/vmware.log", - vmxDir) < 0) - goto cleanup; + virAsprintf(&logFilePath, "%s/vmware.log", vmxDir); if ((logFile = fopen(logFilePath, "r")) == NULL) goto cleanup; diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h index deeed22300..5e0ef3744f 100644 --- a/src/vmware/vmware_conf.h +++ b/src/vmware/vmware_conf.h @@ -71,8 +71,8 @@ int vmwareParseVersionStr(int type, const char *buf, unsigned long *version); int vmwareDomainConfigDisplay(vmwareDomainPtr domain, virDomainDefPtr vmdef); -int vmwareConstructVmxPath(char *directoryName, char *name, - char **vmxPath); +void vmwareConstructVmxPath(char *directoryName, char *name, + char **vmxPath); int vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath); -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list