Replace all the occurrences of ignore_value(VIR_STRDUP(a, b)); with a = g_strdup(b); Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/conf/node_device_util.c | 2 +- src/esx/esx_driver.c | 2 +- src/esx/esx_storage_backend_iscsi.c | 2 +- src/hyperv/hyperv_driver.c | 4 ++-- src/libxl/libxl_domain.c | 15 +++++---------- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 4 ++-- src/network/bridge_driver.c | 2 +- src/node_device/node_device_udev.c | 20 ++++++++++---------- src/nwfilter/nwfilter_dhcpsnoop.c | 2 +- src/openvz/openvz_conf.c | 2 +- src/openvz/openvz_driver.c | 4 ++-- src/qemu/qemu_alias.c | 2 +- src/qemu/qemu_block.c | 2 +- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_driver.c | 8 ++++---- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor_json.c | 2 +- src/rpc/virnetsaslcontext.c | 2 +- src/security/security_apparmor.c | 2 +- src/security/security_nop.c | 2 +- src/security/security_selinux.c | 2 +- src/storage/storage_backend_scsi.c | 2 +- src/storage/storage_backend_sheepdog.c | 2 +- src/storage/storage_driver.c | 4 ++-- src/storage/storage_util.c | 4 ++-- src/test/test_driver.c | 18 +++++++++--------- src/util/virbitmap.c | 2 +- src/util/virhash.c | 2 +- src/util/virlockspace.c | 2 +- src/util/virnetdev.c | 2 +- src/util/virscsi.c | 4 ++-- src/util/virscsihost.c | 2 +- src/util/virstoragefile.c | 2 +- src/util/virstring.c | 2 +- src/util/virtpm.c | 8 ++++---- src/util/virtypedparam.c | 2 +- src/util/virutil.c | 2 +- src/util/virvhba.c | 8 ++++---- src/util/virxml.c | 4 ++-- src/vbox/vbox_common.c | 2 +- src/vbox/vbox_storage.c | 2 +- src/vmware/vmware_conf.c | 2 +- src/vmware/vmware_driver.c | 2 +- src/vmx/vmx.c | 2 +- src/vz/vz_driver.c | 2 +- tests/qemuxml2argvmock.c | 6 +++--- tests/qemuxml2argvtest.c | 4 ++-- tests/testutils.c | 2 +- tests/viriscsitest.c | 12 ++++++------ tests/virstringtest.c | 6 +++--- tests/vmx2xmltest.c | 2 +- tests/xml2vmxtest.c | 2 +- 53 files changed, 101 insertions(+), 106 deletions(-) diff --git a/src/conf/node_device_util.c b/src/conf/node_device_util.c index 859ff9ebbb..3b1e8e487f 100644 --- a/src/conf/node_device_util.c +++ b/src/conf/node_device_util.c @@ -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; diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index cdf925d62c..6c80e97220 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -1856,7 +1856,7 @@ esxDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED) { char *osType; - ignore_value(VIR_STRDUP(osType, "hvm")); + osType = g_strdup("hvm"); return osType; } diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c index e9a30876bf..a7e1f1b340 100644 --- a/src/esx/esx_storage_backend_iscsi.c +++ b/src/esx/esx_storage_backend_iscsi.c @@ -766,7 +766,7 @@ esxStorageVolGetPath(virStorageVolPtr volume) { char *path; - ignore_value(VIR_STRDUP(path, volume->name)); + path = g_strdup(volume->name); return path; } diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 4e99721d37..d69542b500 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -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; } diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 1e4d900ac5..25228af7a6 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -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); } } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 64b21f2073..14bd62b383 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4607,7 +4607,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams) goto cleanup; } - ignore_value(VIR_STRDUP(ret, name)); + ret = g_strdup(name); cleanup: virDomainObjEndAPI(&vm); diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 204a3ed522..7c2e6cf561 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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); diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 6862818698..9dce161937 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4190,7 +4190,7 @@ networkGetBridgeName(virNetworkPtr net) goto cleanup; } - ignore_value(VIR_STRDUP(bridge, def->bridge)); + bridge = g_strdup(def->bridge); cleanup: virNetworkObjEndAPI(&obj); diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index f6729308d7..c9449ace9e 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -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: diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 90f3933959..2c7a1a1522 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -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); diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index be5f89ea45..e5ef426329 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -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++; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 408b393e30..d1153edd00 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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; diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index d294963d35..5af3725bf5 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -758,7 +758,7 @@ qemuDomainGetMasterKeyAlias(void) { char *alias; - ignore_value(VIR_STRDUP(alias, "masterKey0")); + alias = g_strdup("masterKey0"); return alias; } diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 4dc4f2922d..515bcd3d59 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -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; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a97bf65e7f..3ef84cc9a6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bf436f7dc3..421a21818e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c65491f9d6..fed95a285a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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; } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 02308dffe6..4b765da0b1 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6719,7 +6719,7 @@ qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon) goto cleanup; } - ignore_value(VIR_STRDUP(ret, arch)); + ret = g_strdup(arch); cleanup: virJSONValueFree(cmd); diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c index f579162aa2..01ff41b778 100644 --- a/src/rpc/virnetsaslcontext.c +++ b/src/rpc/virnetsaslcontext.c @@ -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); diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 75203cc43a..dd8f7d3808 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -1158,7 +1158,7 @@ AppArmorGetMountOptions(virSecurityManagerPtr mgr G_GNUC_UNUSED, { char *opts; - ignore_value(VIR_STRDUP(opts, "")); + opts = g_strdup(""); return opts; } diff --git a/src/security/security_nop.c b/src/security/security_nop.c index 5e7eed8e7c..c1856eb421 100644 --- a/src/security/security_nop.c +++ b/src/security/security_nop.c @@ -196,7 +196,7 @@ virSecurityDomainGetMountOptionsNop(virSecurityManagerPtr mgr G_GNUC_UNUSED, { char *opts; - ignore_value(VIR_STRDUP(opts, "")); + opts = g_strdup(""); return opts; } diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 0812def922..4988659044 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -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); diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index fd243776f8..98d9d92ac5 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -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; diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index f03c5c7e05..443c224222 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -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; } diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index da09d7de13..ac215c7036 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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); diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 410d412ef1..a4c8a5e971 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -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; } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ab7e5fc02a..bd095604c7 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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")); diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 5ac489004d..a9d8e6c3d5 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -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; } diff --git a/src/util/virhash.c b/src/util/virhash.c index a7fc620567..447b7cfabf 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -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; } diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index c8e520c672..d383746183 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -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; } diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index d8ae5fbc5f..5391f0030b 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -836,7 +836,7 @@ char *virNetDevGetName(int ifindex) goto cleanup; } - ignore_value(VIR_STRDUP(ifname, name)); + ifname = g_strdup(name); cleanup: return ifname; diff --git a/src/util/virscsi.c b/src/util/virscsi.c index 17e8aa1daa..af8692eb5b 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -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; } diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c index a5e8583b2b..10524f49fa 100644 --- a/src/util/virscsihost.c +++ b/src/util/virscsihost.c @@ -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; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index acf26721e7..098d2684cc 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -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; } diff --git a/src/util/virstring.c b/src/util/virstring.c index 6453a23ada..fcae16c8fe 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -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; } diff --git a/src/util/virtpm.c b/src/util/virtpm.c index c7702c8c25..9244697902 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -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; diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 2cd7e81bdd..c2dadfd410 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -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, diff --git a/src/util/virutil.c b/src/util/virutil.c index cf3a397516..637d19e46c 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -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; } diff --git a/src/util/virvhba.c b/src/util/virvhba.c index ac80d9bd79..dbbd8d0f52 100644 --- a/src/util/virvhba.c +++ b/src/util/virvhba.c @@ -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; } diff --git a/src/util/virxml.c b/src/util/virxml.c index 46c79e2d94..209c83b6cc 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -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); diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 56c3c8d896..02c0a894e7 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -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; } diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c index ba5b876ffb..6929a9a2f3 100644 --- a/src/vbox/vbox_storage.c +++ b/src/vbox/vbox_storage.c @@ -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); diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 701062e440..207af8fe81 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -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; } diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 7243453307..912827a921 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -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; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index fa7aa79484..7d20351a83 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -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) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 21425346ac..76b23788b8 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -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); diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index cc9a3ccbff..2b9e5e7a49 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -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; } diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 90edd7a844..7bbc44451d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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); diff --git a/tests/testutils.c b/tests/testutils.c index 15fe561c6b..1c89d503d9 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -767,7 +767,7 @@ virTestLogContentAndReset(void) return NULL; ret = virBufferContentAndReset(&testLog.buf); if (!ret) - ignore_value(VIR_STRDUP(ret, "")); + ret = g_strdup(""); return ret; } diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c index 4722591b86..76f0aa2946 100644 --- a/tests/viriscsitest.c +++ b/tests/viriscsitest.c @@ -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") && diff --git a/tests/virstringtest.c b/tests/virstringtest.c index 43c76ccda0..5d010f7f59 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -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); diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index b2c56a15fe..4c5d41aee5 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -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; diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 2078f5c7cf..0cfdb1facf 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -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; -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list