Use g_strdup instead of ignoring VIR_STRDUP's value

Replace all the occurrences of
  ignore_value(VIR_STRDUP(a, b));
with
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2019-10-18 13:27:03 +02:00
parent d74067c07b
commit 64023f6d21
53 changed files with 101 additions and 106 deletions

View File

@ -54,7 +54,7 @@ virNodeDeviceGetParentName(virConnectPtr conn,
return NULL;
}
ignore_value(VIR_STRDUP(parent, virNodeDeviceGetParent(device)));
parent = g_strdup(virNodeDeviceGetParent(device));
virObjectUnref(device);
return parent;

View File

@ -1856,7 +1856,7 @@ esxDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED)
{
char *osType;
ignore_value(VIR_STRDUP(osType, "hvm"));
osType = g_strdup("hvm");
return osType;
}

View File

@ -766,7 +766,7 @@ esxStorageVolGetPath(virStorageVolPtr volume)
{
char *path;
ignore_value(VIR_STRDUP(path, volume->name));
path = g_strdup(volume->name);
return path;
}

View File

@ -221,7 +221,7 @@ hypervConnectGetHostname(virConnectPtr conn)
goto cleanup;
}
ignore_value(VIR_STRDUP(hostname, computerSystem->data.common->DNSHostName));
hostname = g_strdup(computerSystem->data.common->DNSHostName);
cleanup:
hypervFreeObject(priv, (hypervObject *)computerSystem);
@ -602,7 +602,7 @@ hypervDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED)
{
char *osType;
ignore_value(VIR_STRDUP(osType, "hvm"));
osType = g_strdup("hvm");
return osType;
}

View File

@ -1132,10 +1132,8 @@ libxlConsoleCallback(libxl_ctx *ctx, libxl_event *ev, void *for_callback)
&console);
if (!ret) {
VIR_FREE(chr->source->data.file.path);
if (console && console[0] != '\0') {
ignore_value(VIR_STRDUP(chr->source->data.file.path,
console));
}
if (console && console[0] != '\0')
chr->source->data.file.path = g_strdup(console);
}
VIR_FREE(console);
}
@ -1153,10 +1151,8 @@ libxlConsoleCallback(libxl_ctx *ctx, libxl_event *ev, void *for_callback)
&console);
if (!ret) {
VIR_FREE(chr->source->data.file.path);
if (console && console[0] != '\0') {
ignore_value(VIR_STRDUP(chr->source->data.file.path,
console));
}
if (console && console[0] != '\0')
chr->source->data.file.path = g_strdup(console);
}
VIR_FREE(console);
}
@ -1242,8 +1238,7 @@ libxlDomainCreateChannelPTY(virDomainDefPtr def, libxl_ctx *ctx)
if (!ret && channelinfo.u.pty.path &&
*channelinfo.u.pty.path != '\0') {
VIR_FREE(chr->source->data.file.path);
ignore_value(VIR_STRDUP(chr->source->data.file.path,
channelinfo.u.pty.path));
chr->source->data.file.path = g_strdup(channelinfo.u.pty.path);
}
}

View File

@ -4607,7 +4607,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
goto cleanup;
}
ignore_value(VIR_STRDUP(ret, name));
ret = g_strdup(name);
cleanup:
virDomainObjEndAPI(&vm);

View File

@ -1792,7 +1792,7 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
if (!virDomainObjIsActive(vm)) {
if (nparams)
*nparams = 3;
ignore_value(VIR_STRDUP(ret, "posix"));
ret = g_strdup("posix");
goto cleanup;
}
@ -1809,7 +1809,7 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
*nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
ret = g_strdup("posix");
cleanup:
virDomainObjEndAPI(&vm);

View File

@ -4190,7 +4190,7 @@ networkGetBridgeName(virNetworkPtr net)
goto cleanup;
}
ignore_value(VIR_STRDUP(bridge, def->bridge));
bridge = g_strdup(def->bridge);
cleanup:
virNetworkObjEndAPI(&obj);

View File

@ -665,34 +665,34 @@ udevGetSCSIType(virNodeDeviceDefPtr def G_GNUC_UNUSED,
switch (type) {
case TYPE_DISK:
ignore_value(VIR_STRDUP(*typestring, "disk"));
*typestring = g_strdup("disk");
break;
case TYPE_TAPE:
ignore_value(VIR_STRDUP(*typestring, "tape"));
*typestring = g_strdup("tape");
break;
case TYPE_PROCESSOR:
ignore_value(VIR_STRDUP(*typestring, "processor"));
*typestring = g_strdup("processor");
break;
case TYPE_WORM:
ignore_value(VIR_STRDUP(*typestring, "worm"));
*typestring = g_strdup("worm");
break;
case TYPE_ROM:
ignore_value(VIR_STRDUP(*typestring, "cdrom"));
*typestring = g_strdup("cdrom");
break;
case TYPE_SCANNER:
ignore_value(VIR_STRDUP(*typestring, "scanner"));
*typestring = g_strdup("scanner");
break;
case TYPE_MOD:
ignore_value(VIR_STRDUP(*typestring, "mod"));
*typestring = g_strdup("mod");
break;
case TYPE_MEDIUM_CHANGER:
ignore_value(VIR_STRDUP(*typestring, "changer"));
*typestring = g_strdup("changer");
break;
case TYPE_ENCLOSURE:
ignore_value(VIR_STRDUP(*typestring, "enclosure"));
*typestring = g_strdup("enclosure");
break;
case TYPE_RAID:
ignore_value(VIR_STRDUP(*typestring, "raid"));
*typestring = g_strdup("raid");
break;
case TYPE_NO_LUN:
default:

View File

@ -1395,7 +1395,7 @@ virNWFilterDHCPSnoopThread(void *req0)
fds[i].fd = pcap_fileno(pcapConf[i].handle);
}
tmp = virNetDevGetIndex(req->binding->portdevname, &ifindex);
ignore_value(VIR_STRDUP(threadkey, req->threadkey));
threadkey = g_strdup(req->threadkey);
worker = virThreadPoolNew(1, 1, 0,
virNWFilterDHCPDecodeWorker,
req);

View File

@ -878,7 +878,7 @@ openvzLocateConfDir(void)
while (conf_dir_list[i]) {
if (virFileExists(conf_dir_list[i])) {
ignore_value(VIR_STRDUP(ret, conf_dir_list[i]));
ret = g_strdup(conf_dir_list[i]);
goto cleanup;
}
i++;

View File

@ -373,7 +373,7 @@ static char *openvzDomainGetOSType(virDomainPtr dom)
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
return NULL;
ignore_value(VIR_STRDUP(ret, virDomainOSTypeToString(vm->def->os.type)));
ret = g_strdup(virDomainOSTypeToString(vm->def->os.type));
virDomainObjEndAPI(&vm);
return ret;
@ -716,7 +716,7 @@ openvzGenerateContainerVethName(int veid)
/* try to get line "^NETIF=..." from config */
if (openvzReadVPSConfigParam(veid, "NETIF", &temp) <= 0) {
ignore_value(VIR_STRDUP(name, "eth0"));
name = g_strdup("eth0");
} else {
char *saveptr = NULL;
char *s;

View File

@ -758,7 +758,7 @@ qemuDomainGetMasterKeyAlias(void)
{
char *alias;
ignore_value(VIR_STRDUP(alias, "masterKey0"));
alias = g_strdup("masterKey0");
return alias;
}

View File

@ -1934,7 +1934,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src)
char *ret = NULL;
if (virStorageSourceIsLocalStorage(src)) {
ignore_value(VIR_STRDUP(ret, src->path));
ret = g_strdup(src->path);
return ret;
}

View File

@ -10197,7 +10197,7 @@ qemuDomainStorageAlias(const char *device, int depth)
device = qemuAliasDiskDriveSkipPrefix(device);
if (!depth)
ignore_value(VIR_STRDUP(alias, device));
alias = g_strdup(device);
else
ignore_value(virAsprintf(&alias, "%s.%d", device, depth));
return alias;
@ -14719,7 +14719,7 @@ qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
if (idx)
ignore_value(virAsprintf(&ret, "%s[%d]", disk->dst, idx));
else
ignore_value(VIR_STRDUP(ret, disk->dst));
ret = g_strdup(disk->dst);
return ret;
}

View File

@ -2281,7 +2281,7 @@ static char *qemuDomainGetOSType(virDomainPtr dom) {
if (virDomainGetOSTypeEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
ignore_value(VIR_STRDUP(type, virDomainOSTypeToString(vm->def->os.type)));
type = g_strdup(virDomainOSTypeToString(vm->def->os.type));
cleanup:
virDomainObjEndAPI(&vm);
@ -4062,7 +4062,7 @@ qemuDomainScreenshot(virDomainPtr dom,
goto endjob;
}
ignore_value(VIR_STRDUP(ret, "image/x-portable-pixmap"));
ret = g_strdup("image/x-portable-pixmap");
endjob:
VIR_FORCE_CLOSE(tmp_fd);
@ -9236,7 +9236,7 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
if (!virDomainObjIsActive(vm)) {
if (nparams)
*nparams = 9;
ignore_value(VIR_STRDUP(ret, "posix"));
ret = g_strdup("posix");
goto cleanup;
}
@ -9253,7 +9253,7 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
*nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
ret = g_strdup("posix");
cleanup:
virDomainObjEndAPI(&vm);

View File

@ -1841,7 +1841,7 @@ qemuMigrationDstGetURI(const char *migrateFrom,
if (STREQ(migrateFrom, "stdio"))
ignore_value(virAsprintf(&uri, "fd:%d", migrateFd));
else
ignore_value(VIR_STRDUP(uri, migrateFrom));
uri = g_strdup(migrateFrom);
return uri;
}

View File

@ -6719,7 +6719,7 @@ qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon)
goto cleanup;
}
ignore_value(VIR_STRDUP(ret, arch));
ret = g_strdup(arch);
cleanup:
virJSONValueFree(cmd);

View File

@ -415,7 +415,7 @@ char *virNetSASLSessionListMechanisms(virNetSASLSessionPtr sasl)
_("no SASL mechanisms are available"));
goto cleanup;
}
ignore_value(VIR_STRDUP(ret, mechlist));
ret = g_strdup(mechlist);
cleanup:
virObjectUnlock(sasl);

View File

@ -1158,7 +1158,7 @@ AppArmorGetMountOptions(virSecurityManagerPtr mgr G_GNUC_UNUSED,
{
char *opts;
ignore_value(VIR_STRDUP(opts, ""));
opts = g_strdup("");
return opts;
}

View File

@ -196,7 +196,7 @@ virSecurityDomainGetMountOptionsNop(virSecurityManagerPtr mgr G_GNUC_UNUSED,
{
char *opts;
ignore_value(VIR_STRDUP(opts, ""));
opts = g_strdup("");
return opts;
}

View File

@ -552,7 +552,7 @@ virSecuritySELinuxContextAddRange(security_context_t src,
goto cleanup;
}
ignore_value(VIR_STRDUP(ret, str));
ret = g_strdup(str);
cleanup:
if (srccon) context_free(srccon);

View File

@ -184,7 +184,7 @@ getAdapterName(virStorageAdapterPtr adapter)
unique_id)))
return NULL;
} else {
ignore_value(VIR_STRDUP(name, scsi_host->name));
name = g_strdup(scsi_host->name);
}
} else if (adapter->type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST) {
virStorageAdapterFCHostPtr fchost = &adapter->data.fchost;

View File

@ -343,7 +343,7 @@ virStorageBackendSheepdogRefreshVol(virStoragePoolObjPtr pool,
return -1;
VIR_FREE(vol->target.path);
ignore_value(VIR_STRDUP(vol->target.path, vol->name));
vol->target.path = g_strdup(vol->name);
return 0;
}

View File

@ -1657,7 +1657,7 @@ storageVolLookupByPathCallback(virStoragePoolObjPtr obj,
case VIR_STORAGE_POOL_SHEEPDOG:
case VIR_STORAGE_POOL_ZFS:
case VIR_STORAGE_POOL_LAST:
ignore_value(VIR_STRDUP(stable_path, data->path));
stable_path = g_strdup(data->path);
break;
}
@ -2760,7 +2760,7 @@ storageVolGetPath(virStorageVolPtr vol)
voldef) < 0)
goto cleanup;
ignore_value(VIR_STRDUP(ret, voldef->target.path));
ret = g_strdup(voldef->target.path);
cleanup:
virStoragePoolObjEndAPI(&obj);

View File

@ -1986,7 +1986,7 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
* the original non-stable dev path
*/
ignore_value(VIR_STRDUP(stablepath, devpath));
stablepath = g_strdup(devpath);
return stablepath;
}
@ -3641,7 +3641,7 @@ virStorageBackendSCSISerial(const char *dev,
if (rc == -2)
return NULL;
ignore_value(VIR_STRDUP(serial, dev));
serial = g_strdup(dev);
return serial;
}

View File

@ -725,7 +725,7 @@ static char *testBuildFilename(const char *relativeTo,
if (!filename || filename[0] == '\0')
return NULL;
if (filename[0] == '/') {
ignore_value(VIR_STRDUP(ret, filename));
ret = g_strdup(filename);
return ret;
}
@ -742,7 +742,7 @@ static char *testBuildFilename(const char *relativeTo,
strcat(absFile, filename);
return absFile;
} else {
ignore_value(VIR_STRDUP(ret, filename));
ret = g_strdup(filename);
return ret;
}
}
@ -1585,7 +1585,7 @@ testConnectGetSysinfo(virConnectPtr conn G_GNUC_UNUSED,
virCheckFlags(0, NULL);
ignore_value(VIR_STRDUP(ret, sysinfo));
ret = g_strdup(sysinfo);
return ret;
}
@ -2561,7 +2561,7 @@ testDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED)
{
char *ret;
ignore_value(VIR_STRDUP(ret, "linux"));
ret = g_strdup("linux");
return ret;
}
@ -4889,7 +4889,7 @@ static char *testDomainGetSchedulerType(virDomainPtr domain G_GNUC_UNUSED,
if (nparams)
*nparams = 1;
ignore_value(VIR_STRDUP(type, "fair"));
type = g_strdup("fair");
return type;
}
@ -5611,7 +5611,7 @@ testNetworkGetBridgeName(virNetworkPtr net)
goto cleanup;
}
ignore_value(VIR_STRDUP(bridge, def->bridge));
bridge = g_strdup(def->bridge);
cleanup:
virNetworkObjEndAPI(&obj);
@ -6367,7 +6367,7 @@ testConnectFindStoragePoolSources(virConnectPtr conn G_GNUC_UNUSED,
switch (pool_type) {
case VIR_STORAGE_POOL_LOGICAL:
ignore_value(VIR_STRDUP(ret, defaultPoolSourcesLogicalXML));
ret = g_strdup(defaultPoolSourcesLogicalXML);
return ret;
case VIR_STORAGE_POOL_NETFS:
@ -7241,7 +7241,7 @@ testStorageVolGetPath(virStorageVolPtr vol)
if (!(privvol = testStorageVolDefFindByName(obj, vol->name)))
goto cleanup;
ignore_value(VIR_STRDUP(ret, privvol->target.path));
ret = g_strdup(privvol->target.path);
cleanup:
virStoragePoolObjEndAPI(&obj);
@ -7362,7 +7362,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
def = virNodeDeviceObjGetDef(obj);
if (def->parent) {
ignore_value(VIR_STRDUP(ret, def->parent));
ret = g_strdup(def->parent);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no parent for this device"));

View File

@ -418,7 +418,7 @@ virBitmapFormat(virBitmapPtr bitmap)
if (!bitmap || (cur = virBitmapNextSetBit(bitmap, -1)) < 0) {
char *ret;
ignore_value(VIR_STRDUP(ret, ""));
ret = g_strdup("");
return ret;
}

View File

@ -94,7 +94,7 @@ static bool virHashStrEqual(const void *namea, const void *nameb)
static void *virHashStrCopy(const void *name)
{
char *ret;
ignore_value(VIR_STRDUP(ret, name));
ret = g_strdup(name);
return ret;
}

View File

@ -69,7 +69,7 @@ static char *virLockSpaceGetResourcePath(virLockSpacePtr lockspace,
if (lockspace->dir)
ignore_value(virAsprintf(&ret, "%s/%s", lockspace->dir, resname));
else
ignore_value(VIR_STRDUP(ret, resname));
ret = g_strdup(resname);
return ret;
}

View File

@ -836,7 +836,7 @@ char *virNetDevGetName(int ifindex)
goto cleanup;
}
ignore_value(VIR_STRDUP(ifname, name));
ifname = g_strdup(name);
cleanup:
return ifname;

View File

@ -127,7 +127,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
while (virDirRead(dir, &entry, path) > 0) {
/* Assume a single directory entry */
ignore_value(VIR_STRDUP(sg, entry->d_name));
sg = g_strdup(entry->d_name);
break;
}
@ -165,7 +165,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
goto cleanup;
while (virDirRead(dir, &entry, path) > 0) {
ignore_value(VIR_STRDUP(name, entry->d_name));
name = g_strdup(entry->d_name);
break;
}

View File

@ -157,7 +157,7 @@ virSCSIHostFindByPCI(const char *sysfs_prefix,
continue;
}
ignore_value(VIR_STRDUP(ret, entry->d_name));
ret = g_strdup(entry->d_name);
break;
}

View File

@ -4014,7 +4014,7 @@ virStorageFileCanonicalizeFormatPath(char **components,
/* if the output string is empty just return an empty string */
if (!(ret = virBufferContentAndReset(&buf)))
ignore_value(VIR_STRDUP(ret, ""));
ret = g_strdup("");
return ret;
}

View File

@ -160,7 +160,7 @@ char *virStringListJoin(const char **strings,
return NULL;
ret = virBufferContentAndReset(&buf);
if (!ret)
ignore_value(VIR_STRDUP(ret, ""));
ret = g_strdup("");
return ret;
}

View File

@ -75,7 +75,7 @@ virTPMCreateCancelPath(const char *devpath)
VIR_FREE(path);
}
if (!path)
ignore_value(VIR_STRDUP(path, "/dev/null"));
path = g_strdup("/dev/null");
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("TPM device path %s is invalid"), devpath);
@ -116,7 +116,7 @@ virTPMGetSwtpm(void)
return NULL;
virMutexLock(&swtpm_tools_lock);
ignore_value(VIR_STRDUP(s, swtpm_path));
s = g_strdup(swtpm_path);
virMutexUnlock(&swtpm_tools_lock);
return s;
@ -131,7 +131,7 @@ virTPMGetSwtpmSetup(void)
return NULL;
virMutexLock(&swtpm_tools_lock);
ignore_value(VIR_STRDUP(s, swtpm_setup));
s = g_strdup(swtpm_setup);
virMutexUnlock(&swtpm_tools_lock);
return s;
@ -146,7 +146,7 @@ virTPMGetSwtpmIoctl(void)
return NULL;
virMutexLock(&swtpm_tools_lock);
ignore_value(VIR_STRDUP(s, swtpm_ioctl));
s = g_strdup(swtpm_ioctl);
virMutexUnlock(&swtpm_tools_lock);
return s;

View File

@ -194,7 +194,7 @@ virTypedParameterToString(virTypedParameterPtr param)
ignore_value(virAsprintf(&value, "%d", param->value.b));
break;
case VIR_TYPED_PARAM_STRING:
ignore_value(VIR_STRDUP(value, param->value.s));
value = g_strdup(param->value.s);
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,

View File

@ -714,7 +714,7 @@ static char *virGetGroupEnt(gid_t gid)
return NULL;
}
ignore_value(VIR_STRDUP(ret, gr->gr_name));
ret = g_strdup(gr->gr_name);
VIR_FREE(strbuf);
return ret;
}

View File

@ -148,7 +148,7 @@ virVHBAGetConfig(const char *sysfs_prefix,
else
p = buf;
ignore_value(VIR_STRDUP(result, p));
result = g_strdup(p);
cleanup:
VIR_FREE(sysfs_path);
@ -222,7 +222,7 @@ virVHBAFindVportHost(const char *sysfs_prefix)
if ((strlen(max_vports) >= strlen(vports)) ||
((strlen(max_vports) == strlen(vports)) &&
strcmp(max_vports, vports) > 0)) {
ignore_value(VIR_STRDUP(ret, entry->d_name));
ret = g_strdup(entry->d_name);
goto cleanup;
}
@ -403,7 +403,7 @@ virVHBAGetHostByWWN(const char *sysfs_prefix,
if (rc == 0)
continue;
ignore_value(VIR_STRDUP(ret, entry->d_name));
ret = g_strdup(entry->d_name);
break;
}
@ -454,7 +454,7 @@ virVHBAGetHostByFabricWWN(const char *sysfs_prefix,
if (rc == 0)
continue;
ignore_value(VIR_STRDUP(ret, entry->d_name));
ret = g_strdup(entry->d_name);
break;
}

View File

@ -91,7 +91,7 @@ virXPathString(const char *xpath,
xmlXPathFreeObject(obj);
return NULL;
}
ignore_value(VIR_STRDUP(ret, (char *) obj->stringval));
ret = g_strdup((char *)obj->stringval);
xmlXPathFreeObject(obj);
return ret;
}
@ -995,7 +995,7 @@ virXMLNodeToString(xmlDocPtr doc,
goto cleanup;
}
ignore_value(VIR_STRDUP(ret, (const char *)xmlBufferContent(xmlbuf)));
ret = g_strdup((const char *)xmlBufferContent(xmlbuf));
cleanup:
xmlBufferFree(xmlbuf);

View File

@ -2701,7 +2701,7 @@ static char *vboxDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED) {
*/
char *osType;
ignore_value(VIR_STRDUP(osType, "hvm"));
osType = g_strdup("hvm");
return osType;
}

View File

@ -843,7 +843,7 @@ static char *vboxStorageVolGetPath(virStorageVolPtr vol)
if (!hddLocationUtf8)
goto cleanup;
ignore_value(VIR_STRDUP(ret, hddLocationUtf8));
ret = g_strdup(hddLocationUtf8);
VIR_DEBUG("Storage Volume Name: %s", vol->name);
VIR_DEBUG("Storage Volume Path: %s", hddLocationUtf8);

View File

@ -541,6 +541,6 @@ vmwareCopyVMXFileName(const char *datastorePath, void *opaque G_GNUC_UNUSED)
{
char *path;
ignore_value(VIR_STRDUP(path, datastorePath));
path = g_strdup(datastorePath);
return path;
}

View File

@ -844,7 +844,7 @@ vmwareDomainGetOSType(virDomainPtr dom)
if (!(vm = vmwareDomObjFromDomain(driver, dom->uuid)))
return NULL;
ignore_value(VIR_STRDUP(ret, virDomainOSTypeToString(vm->def->os.type)));
ret = g_strdup(virDomainOSTypeToString(vm->def->os.type));
virDomainObjEndAPI(&vm);
return ret;

View File

@ -3595,7 +3595,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
fileName = ctx->formatFileName(src, ctx->opaque);
} else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
ignore_value(VIR_STRDUP(fileName, "emptyBackingString"));
fileName = g_strdup("emptyBackingString");
}
if (fileName == NULL)

View File

@ -677,7 +677,7 @@ vzDomainGetOSType(virDomainPtr domain)
if (virDomainGetOSTypeEnsureACL(domain->conn, dom->def) < 0)
goto cleanup;
ignore_value(VIR_STRDUP(ret, virDomainOSTypeToString(dom->def->os.type)));
ret = g_strdup(virDomainOSTypeToString(dom->def->os.type));
cleanup:
virDomainObjEndAPI(&dom);

View File

@ -101,7 +101,7 @@ virTPMCreateCancelPath(const char *devpath)
char *path;
(void)devpath;
ignore_value(VIR_STRDUP(path, "/sys/class/misc/tpm0/device/cancel"));
path = g_strdup("/sys/class/misc/tpm0/device/cancel");
return path;
}
@ -125,7 +125,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix G_GNUC_UNUSED,
{
char *ret;
ignore_value(VIR_STRDUP(ret, "sg0"));
ret = g_strdup("sg0");
return ret;
}
@ -199,7 +199,7 @@ virHostGetDRMRenderNode(void)
{
char *dst = NULL;
ignore_value(VIR_STRDUP(dst, "/dev/dri/foo"));
dst = g_strdup("/dev/dri/foo");
return dst;
}

View File

@ -1215,7 +1215,7 @@ mymain(void)
driver.config->vncSASL = 1;
VIR_FREE(driver.config->vncSASLdir);
ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
driver.config->vncSASLdir = g_strdup("/root/.sasl2");
DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncTLS = 1;
driver.config->vncTLSx509verify = 1;
@ -1247,7 +1247,7 @@ mymain(void)
DO_TEST("graphics-spice-no-args",
QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->spiceSASL = 1;
ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
driver.config->spiceSASLdir = g_strdup("/root/.sasl2");
DO_TEST("graphics-spice-sasl",
QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL);

View File

@ -767,7 +767,7 @@ virTestLogContentAndReset(void)
return NULL;
ret = virBufferContentAndReset(&testLog.buf);
if (!ret)
ignore_value(VIR_STRDUP(ret, ""));
ret = g_strdup("");
return ret;
}

View File

@ -87,9 +87,9 @@ static void testIscsiadmCb(const char *const*args,
args[2] && STREQ(args[2], "session") &&
args[3] == NULL) {
if (data->output_version)
ignore_value(VIR_STRDUP(*output, iscsiadmSessionOutputNonFlash));
*output = g_strdup(iscsiadmSessionOutputNonFlash);
else
ignore_value(VIR_STRDUP(*output, iscsiadmSessionOutput));
*output = g_strdup(iscsiadmSessionOutput);
} else if (args[0] && STREQ(args[0], ISCSIADM) &&
args[1] && STREQ(args[1], "--mode") &&
args[2] && STREQ(args[2], "discovery") &&
@ -100,7 +100,7 @@ static void testIscsiadmCb(const char *const*args,
args[7] && STREQ(args[7], "--op") &&
args[8] && STREQ(args[8], "nonpersistent") &&
args[9] == NULL) {
ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput));
*output = g_strdup(iscsiadmSendtargetsOutput);
} else if (args[0] && STREQ(args[0], ISCSIADM) &&
args[1] && STREQ(args[1], "--mode") &&
args[2] && STREQ(args[2], "node") &&
@ -125,9 +125,9 @@ static void testIscsiadmCb(const char *const*args,
args[2] && STREQ(args[2], "iface") &&
args[3] == NULL) {
if (data->iface_created)
ignore_value(VIR_STRDUP(*output, iscsiadmIfaceIfaceOutput));
*output = g_strdup(iscsiadmIfaceIfaceOutput);
else
ignore_value(VIR_STRDUP(*output, iscsiadmIfaceDefaultOutput));
*output = g_strdup(iscsiadmIfaceDefaultOutput);
} else if (args[0] && STREQ(args[0], ISCSIADM) &&
args[1] && STREQ(args[1], "--mode") &&
args[2] && STREQ(args[2], "iface") &&
@ -171,7 +171,7 @@ static void testIscsiadmCb(const char *const*args,
args[8] && STREQ(args[8], "libvirt-iface-03020100") &&
args[9] == NULL &&
data->iface_created) {
ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput));
*output = g_strdup(iscsiadmSendtargetsOutput);
} else if (args[0] && STREQ(args[0], ISCSIADM) &&
args[1] && STREQ(args[1], "--mode") &&
args[2] && STREQ(args[2], "node") &&

View File

@ -697,9 +697,9 @@ testVirStringListFreeCount(const void *opaque G_GNUC_UNUSED)
if (VIR_ALLOC_N(list, 4) < 0)
return -1;
ignore_value(VIR_STRDUP(list[0], "test1"));
ignore_value(VIR_STRDUP(list[2], "test2"));
ignore_value(VIR_STRDUP(list[3], "test3"));
list[0] = g_strdup("test1");
list[2] = g_strdup("test2");
list[3] = g_strdup("test3");
virStringListFreeCount(list, 4);

View File

@ -157,7 +157,7 @@ testParseVMXFileName(const char *fileName, void *opaque G_GNUC_UNUSED)
goto cleanup;
} else if (STRPREFIX(fileName, "/")) {
/* Found absolute path referencing a file outside a datastore */
ignore_value(VIR_STRDUP(src, fileName));
src = g_strdup(fileName);
} else if (strchr(fileName, '/') != NULL) {
/* Found relative path, this is not supported */
src = NULL;

View File

@ -175,7 +175,7 @@ testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED)
goto cleanup;
} else if (STRPREFIX(src, "/")) {
/* Found absolute path */
ignore_value(VIR_STRDUP(absolutePath, src));
absolutePath = g_strdup(src);
} else {
/* Found relative path, this is not supported */
goto cleanup;