Instead of the following pattern: type ret; ... ret = func(); return ret; we can use: return func() directly. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_addr.c | 8 +------- src/conf/domain_conf.c | 8 +++----- src/conf/network_conf.c | 5 +---- src/conf/virnetworkportdef.c | 5 +---- src/qemu/qemu_capabilities.c | 5 +---- src/qemu/qemu_command.c | 8 ++------ src/qemu/qemu_conf.c | 9 ++------- src/qemu/qemu_domain.c | 12 +++--------- src/qemu/qemu_driver.c | 18 ++++++------------ src/qemu/qemu_tpm.c | 11 ++--------- src/security/security_apparmor.c | 5 +---- src/security/security_util.c | 9 +++------ src/storage/storage_driver.c | 7 ++----- src/util/vircgroup.c | 5 +---- src/util/virmdev.c | 10 ++-------- src/util/virresctrl.c | 6 +----- src/util/virsocketaddr.c | 5 +---- src/util/virutil.c | 8 +++----- tests/qemuxml2argvtest.c | 6 +----- 19 files changed, 37 insertions(+), 113 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 5652bc9a33..8623e79daf 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1392,13 +1392,7 @@ virDomainPCIAddressSetAllMulti(virDomainDefPtr def) static char* virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr) { - char *addrstr = NULL; - - addrstr = g_strdup_printf("%x.%x.%04x", - addr->cssid, - addr->ssid, - addr->devno); - return addrstr; + return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno); } static int diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8a87586936..83748354b0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31316,54 +31316,52 @@ char * virDomainDefGetShortName(const virDomainDef *def) { wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] = {0}; size_t len = 0; - char *ret = NULL; g_autofree char *shortname = NULL; /* No need to do the whole conversion thing when there are no multibyte * characters. The same applies for illegal sequences as they can occur * with incompatible locales. */ len = mbstowcs(NULL, def->name, 0); if ((len == (size_t) -1 && errno == EILSEQ) || len == strlen(def->name)) { - ret = g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, def->name); - return ret; + return g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, + def->name); } if (len == (size_t) -1) { virReportSystemError(errno, "%s", _("Cannot convert domain name to " "wide character string")); return NULL; } if (mbstowcs(wshortname, def->name, VIR_DOMAIN_SHORT_NAME_MAX) == (size_t) -1) { virReportSystemError(errno, "%s", _("Cannot convert domain name to " "wide character string")); return NULL; } len = wcstombs(NULL, wshortname, 0); if (len == (size_t) -1) { virReportSystemError(errno, "%s", _("Cannot convert wide character string " "back to multi-byte domain name")); return NULL; } if (VIR_ALLOC_N(shortname, len + 1) < 0) return NULL; if (wcstombs(shortname, wshortname, len) == (size_t) -1) { virReportSystemError(errno, "%s", _("Cannot convert wide character string " "back to multi-byte domain name")); return NULL; } - ret = g_strdup_printf("%d-%s", def->id, shortname); - return ret; + return g_strdup_printf("%d-%s", def->id, shortname); } #undef VIR_DOMAIN_SHORT_NAME_MAX diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index a7c177f8db..dc64ce6959 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2892,10 +2892,7 @@ char * virNetworkConfigFile(const char *dir, const char *name) { - char *ret = NULL; - - ret = g_strdup_printf("%s/%s.xml", dir, name); - return ret; + return g_strdup_printf("%s/%s.xml", dir, name); } diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index a4cffea8b6..2013e11dff 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -432,10 +432,7 @@ static char * virNetworkPortDefConfigFile(const char *dir, const char *name) { - char *ret = NULL; - - ret = g_strdup_printf("%s/%s.xml", dir, name); - return ret; + return g_strdup_printf("%s/%s.xml", dir, name); } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 47f88481c8..c7e58f92ae 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4467,79 +4467,76 @@ char * virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; - char *ret = NULL; size_t i; virBufferAddLit(&buf, "<qemuCaps>\n"); virBufferAdjustIndent(&buf, 2); virBufferEscapeString(&buf, "<emulator>%s</emulator>\n", qemuCaps->binary); virBufferAsprintf(&buf, "<qemuctime>%llu</qemuctime>\n", (long long)qemuCaps->ctime); virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n", (long long)qemuCaps->libvirtCtime); virBufferAsprintf(&buf, "<selfvers>%lu</selfvers>\n", (unsigned long)qemuCaps->libvirtVersion); for (i = 0; i < QEMU_CAPS_LAST; i++) { if (virQEMUCapsGet(qemuCaps, i)) { virBufferAsprintf(&buf, "<flag name='%s'/>\n", virQEMUCapsTypeToString(i)); } } virBufferAsprintf(&buf, "<version>%d</version>\n", qemuCaps->version); virBufferAsprintf(&buf, "<kvmVersion>%d</kvmVersion>\n", qemuCaps->kvmVersion); virBufferAsprintf(&buf, "<microcodeVersion>%u</microcodeVersion>\n", qemuCaps->microcodeVersion); if (qemuCaps->package) virBufferAsprintf(&buf, "<package>%s</package>\n", qemuCaps->package); if (qemuCaps->kernelVersion) virBufferAsprintf(&buf, "<kernelVersion>%s</kernelVersion>\n", qemuCaps->kernelVersion); virBufferAsprintf(&buf, "<arch>%s</arch>\n", virArchToString(qemuCaps->arch)); virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM); virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU); for (i = 0; i < qemuCaps->ngicCapabilities; i++) { virGICCapabilityPtr cap; bool kernel; bool emulated; cap = &qemuCaps->gicCapabilities[i]; kernel = (cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL); emulated = (cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED); virBufferAsprintf(&buf, "<gic version='%d' kernel='%s' emulated='%s'/>\n", cap->version, kernel ? "yes" : "no", emulated ? "yes" : "no"); } if (qemuCaps->sevCapabilities) virQEMUCapsFormatSEVInfo(qemuCaps, &buf); if (qemuCaps->kvmSupportsNesting) virBufferAddLit(&buf, "<kvmSupportsNesting/>\n"); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "</qemuCaps>\n"); - ret = virBufferContentAndReset(&buf); - - return ret; + return virBufferContentAndReset(&buf); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6acfc0b19d..269bdbaf56 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -251,44 +251,40 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, static char * qemuVirCommandGetFDSet(virCommandPtr cmd, int fd) { - char *result = NULL; int idx = virCommandPassFDGetFDIndex(cmd, fd); if (idx < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("file descriptor %d has not been transferred"), fd); return NULL; } - result = g_strdup_printf("set=%d,fd=%d", idx, fd); - return result; + return g_strdup_printf("set=%d,fd=%d", idx, fd); } /** * qemuVirCommandGetDevSet: * @cmd: the command to modify * @fd: fd to reassign to the child * * Get the parameters for the QEMU path= parameter where a file * descriptor is accessed via a file descriptor set, for example * /dev/fdset/10. The file descriptor must previously have been * 'transferred' in a virCommandPassFD() call. */ static char * qemuVirCommandGetDevSet(virCommandPtr cmd, int fd) { - char *result = NULL; int idx = virCommandPassFDGetFDIndex(cmd, fd); if (idx < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("file descriptor %d has not been transferred"), fd); return NULL; } - result = g_strdup_printf("/dev/fdset/%d", idx); - return result; + return g_strdup_printf("/dev/fdset/%d", idx); } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index c59824006c..2d5e527b47 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1429,29 +1429,26 @@ char * qemuGetSharedDeviceKey(const char *device_path) { int maj, min; - char *key = NULL; int rc; if ((rc = virGetDeviceID(device_path, &maj, &min)) < 0) { virReportSystemError(-rc, _("Unable to get minor number of device '%s'"), device_path); return NULL; } - key = g_strdup_printf("%d:%d", maj, min); - - return key; + return g_strdup_printf("%d:%d", maj, min); } /* * Make necessary checks for the need to check and for the current setting * of the 'unpriv_sgio' value for the device_path passed. * * Returns: * 0 - Success * -1 - Some failure which would already have been messaged * -2 - Mismatch with the "shared" sgio setting - needs to be messaged * by caller since it has context of which type of disk resource is * being used and in the future the hostdev information. */ @@ -1704,19 +1701,17 @@ static char * qemuGetHostdevPath(virDomainHostdevDefPtr hostdev) { virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; g_autofree char *dev_name = NULL; - char *dev_path = NULL; if (!(dev_name = virSCSIDeviceGetDevName(NULL, scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit))) return NULL; - dev_path = g_strdup_printf("/dev/%s", dev_name); - return dev_path; + return g_strdup_printf("/dev/%s", dev_name); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d63ec2313b..9c629c31a3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6835,17 +6835,14 @@ virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver, virQEMUCapsPtr qemuCaps, virDomainDefPtr src, unsigned int flags) { - virDomainDefPtr ret = NULL; g_autofree char *xml = NULL; if (!(xml = qemuDomainDefFormatXML(driver, qemuCaps, src, flags))) return NULL; - ret = qemuDomainDefFromXML(driver, qemuCaps, xml); - - return ret; + return qemuDomainDefFromXML(driver, qemuCaps, xml); } @@ -13364,17 +13361,14 @@ qemuProcessEventFree(struct qemuProcessEvent *event) char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv) { - char *ret = NULL; - - ret = g_strdup_printf("%s/%s.sock", priv->libDir, qemuDomainGetManagedPRAlias()); - - return ret; + return g_strdup_printf("%s/%s.sock", priv->libDir, + qemuDomainGetManagedPRAlias()); } /** * qemuDomainStorageIdNew: * @priv: qemu VM private data object. * * Generate a new unique id for a storage object. Useful for node name generation. */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d5aeeac66d..1c7c87128d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7439,31 +7439,25 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, static int qemuConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames) { virQEMUDriverPtr driver = conn->privateData; - int ret = -1; if (virConnectListDefinedDomainsEnsureACL(conn) < 0) return -1; - ret = virDomainObjListGetInactiveNames(driver->domains, names, nnames, - virConnectListDefinedDomainsCheckACL, - conn); - - return ret; + return virDomainObjListGetInactiveNames(driver->domains, names, nnames, + virConnectListDefinedDomainsCheckACL, + conn); } static int qemuConnectNumOfDefinedDomains(virConnectPtr conn) { virQEMUDriverPtr driver = conn->privateData; - int ret = -1; if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0) return -1; - ret = virDomainObjListNumOfDomains(driver->domains, false, - virConnectNumOfDefinedDomainsCheckACL, - conn); - - return ret; + return virDomainObjListNumOfDomains(driver->domains, false, + virConnectNumOfDefinedDomainsCheckACL, + conn); } diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 58dfdf689a..fe567f440c 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -171,19 +171,15 @@ static char * qemuTPMCreateEmulatorSocket(const char *swtpmStateDir, const char *shortName) { - char *path = NULL; - - path = g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName); - - return path; + return g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName); } /* * qemuTPMEmulatorInitPaths: * * @tpm: TPM definition for an emulator type * @swtpmStorageDir: the general swtpm storage dir which is used as a base * directory for creating VM specific directories * @uuid: the UUID of the VM */ @@ -213,25 +209,22 @@ static char * qemuTPMEmulatorCreatePidFilename(const char *swtpmStateDir, const char *shortName) { - char *pidfile = NULL; g_autofree char *devicename = NULL; devicename = g_strdup_printf("%s-swtpm", shortName); - pidfile = virPidFileBuildPath(swtpmStateDir, devicename); - - return pidfile; + return virPidFileBuildPath(swtpmStateDir, devicename); } /* * qemuTPMEmulatorGetPid * * @swtpmStateDir: the directory where swtpm writes the pidfile into * @shortName: short name of the domain * @pid: pointer to pid * * Return -1 upon error, or zero on successful reading of the pidfile. * If the PID was not still alive, zero will be returned, and @pid will be * set to -1; */ diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 3bc200ffb3..7c8fd39584 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -213,15 +213,12 @@ static char * get_profile_name(virDomainDefPtr def) { char uuidstr[VIR_UUID_STRING_BUFLEN]; - char *name = NULL; virUUIDFormat(def->uuid, uuidstr); - name = g_strdup_printf("%s%s", AA_PREFIX, uuidstr); - - return name; + return g_strdup_printf("%s%s", AA_PREFIX, uuidstr); } /* returns -1 on error or profile for libvirtd is unconfined, 0 if complain * mode and 1 if enforcing. This is required because at present you cannot * aa_change_profile() from a process that is unconfined. */ diff --git a/src/security/security_util.c b/src/security/security_util.c index 4f661fd75e..7fa5163fe4 100644 --- a/src/security/security_util.c +++ b/src/security/security_util.c @@ -92,9 +92,8 @@ virSecurityGetRefCountAttrName(const char *name G_GNUC_UNUSED) static char * virSecurityGetTimestampAttrName(const char *name) { - char *ret = NULL; - ret = g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s", name); - return ret; + return g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s", + name); } #else /* !XATTR_NAMESPACE */ static char * @@ -112,49 +111,47 @@ static char * virSecurityGetTimestamp(void) { unsigned long long boottime = 0; - char *ret = NULL; if (virHostGetBootTime(&boottime) < 0) { virReportSystemError(errno, "%s", _("Unable to get host boot time")); return NULL; } - ret = g_strdup_printf("%llu", boottime); - return ret; + return g_strdup_printf("%llu", boottime); } /** * virSecurityValidateTimestamp: * @name: security driver name * @path: file name * * Check if remembered label on @path for security driver @name * is valid, i.e. the label has been set since the last boot. If * the label was set in previous runs, all XATTRs related to * @name are removed so that clean slate is restored. * * This is done having extra attribute timestamp_$SECDRIVER which * contains the host boot time. Its value is then compared to * actual host boot time. If these two values don't match then * XATTRs are considered as stale and thus invalid. * * In ideal world, where there network file systems have XATTRs * using plain host boot time is not enough as it may lead to a * situation where a freshly started host sees XATTRs, sees the * timestamp put there by some longer running host and considers * the XATTRs invalid. Well, there is not an easy way out. We * would need to somehow check if the longer running host is * still there and uses the @path (how?). * Fortunately, there is only one network file system which * supports XATTRs currently (GlusterFS via FUSE) and it is used * so rarely that it's almost a corner case. * The worst thing that happens there is that we remove XATTRs * and thus return @path to the default label for $SECDRIVER. * * Returns: 0 if remembered label is valid, * 1 if remembered label was not valid, * -2 if underlying file system doesn't support XATTRs, * -1 otherwise. */ diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 2db763caa5..7e82c09be5 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -2837,13 +2837,10 @@ char * virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr obj, virStorageVolDefPtr voldef) { virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj); - char *tmp = NULL; - - tmp = g_strdup_printf("%s/%s.%s.secret.XXXXXX", - driver->stateDir, def->name, voldef->name); - return tmp; + return g_strdup_printf("%s/%s.%s.secret.XXXXXX", driver->stateDir, + def->name, voldef->name); } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 70d85200cb..bb535df4f2 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -423,28 +423,25 @@ virCgroupDetect(virCgroupPtr group, char * virCgroupGetBlockDevString(const char *path) { - char *ret = NULL; struct stat sb; if (stat(path, &sb) < 0) { virReportSystemError(errno, _("Path '%s' is not accessible"), path); return NULL; } if (!S_ISBLK(sb.st_mode)) { virReportSystemError(EINVAL, _("Path '%s' must be a block device"), path); return NULL; } /* Automatically append space after the string since all callers * use it anyway */ - ret = g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev)); - - return ret; + return g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev)); } diff --git a/src/util/virmdev.c b/src/util/virmdev.c index c2499c0a20..51a88a91d7 100644 --- a/src/util/virmdev.c +++ b/src/util/virmdev.c @@ -206,31 +206,28 @@ char * virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr) { g_autofree char *result_path = NULL; g_autofree char *result_file = NULL; g_autofree char *iommu_path = NULL; g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr); - char *vfio_path = NULL; if (!dev_path) return NULL; iommu_path = g_strdup_printf("%s/iommu_group", dev_path); if (!virFileExists(iommu_path)) { virReportSystemError(errno, _("failed to access '%s'"), iommu_path); return NULL; } if (virFileResolveLink(iommu_path, &result_path) < 0) { virReportSystemError(errno, _("failed to resolve '%s'"), iommu_path); return NULL; } result_file = g_path_get_basename(result_path); - vfio_path = g_strdup_printf("/dev/vfio/%s", result_file); - - return vfio_path; + return g_strdup_printf("/dev/vfio/%s", result_file); } @@ -422,10 +419,7 @@ virMediatedDeviceIsUsed(virMediatedDevicePtr dev, char * virMediatedDeviceGetSysfsPath(const char *uuidstr) { - char *ret = NULL; - - ret = g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr); - return ret; + return g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr); } diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index c537d606cc..e17f6bd1bd 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2307,19 +2307,15 @@ static char * virResctrlDeterminePath(const char *parentpath, const char *prefix, const char *id) { - char *path = NULL; - if (!id) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Resctrl ID must be set before determining resctrl " "parentpath='%s' prefix='%s'"), parentpath, prefix); return NULL; } - path = g_strdup_printf("%s/%s-%s", parentpath, prefix, id); - - return path; + return g_strdup_printf("%s/%s-%s", parentpath, prefix, id); } diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 4c9f124e88..a858a69204 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -578,35 +578,32 @@ char * virSocketAddrGetPath(virSocketAddrPtr addr G_GNUC_UNUSED) { #ifndef WIN32 - char *path = NULL; if (addr == NULL) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("No socket address provided")); return NULL; } if (addr->data.sa.sa_family != AF_UNIX) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("UNIX socket address is required")); return NULL; } - path = g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path)); - - return path; + return g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path)); #else virReportError(VIR_ERR_NO_SUPPORT, "%s", _("UNIX sockets not supported on this platform")); return NULL; #endif } /** * virSocketAddrIsNetmask: * @netmask: the netmask address * * Check that @netmask is a proper network mask * * Returns 0 in case of success and -1 in case of error */ diff --git a/src/util/virutil.c b/src/util/virutil.c index 5b52e4e6d4..fb46501142 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1419,21 +1419,19 @@ char * virGetUnprivSGIOSysfsPath(const char *path, const char *sysfs_dir) { int maj, min; - char *sysfs_path = NULL; int rc; if ((rc = virGetDeviceID(path, &maj, &min)) < 0) { virReportSystemError(-rc, _("Unable to get device ID '%s'"), path); return NULL; } - sysfs_path = g_strdup_printf("%s/%d:%d/queue/unpriv_sgio", - sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH, - maj, min); - return sysfs_path; + return g_strdup_printf("%s/%d:%d/queue/unpriv_sgio", + sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH, maj, + min); } int diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4a303c0185..04febd1b0c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -185,11 +185,7 @@ fakeStorageVolGetInfo(virStorageVolPtr vol, static char * fakeStorageVolGetPath(virStorageVolPtr vol) { - char *ret = NULL; - - ret = g_strdup_printf("/some/%s/device/%s", vol->key, vol->name); - - return ret; + return g_strdup_printf("/some/%s/device/%s", vol->key, vol->name); } -- 2.26.2