Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/capabilities.c | 2 +- src/conf/domain_addr.c | 8 +++---- src/conf/domain_audit.c | 38 ++++++++++++++++---------------- src/conf/domain_conf.c | 30 ++++++++++++------------- src/conf/moment_conf.c | 2 +- src/conf/network_conf.c | 2 +- src/conf/node_device_util.c | 2 +- src/conf/snapshot_conf.c | 2 +- src/conf/storage_conf.c | 4 ++-- src/conf/virchrdev.c | 4 ++-- src/conf/virnetworkobj.c | 6 ++--- src/conf/virnetworkportdef.c | 2 +- src/conf/virnwfilterbindingobj.c | 2 +- src/conf/virstorageobj.c | 2 +- 14 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index b93b6ff451..0bc955230f 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1869,7 +1869,7 @@ virCapabilitiesInitCaches(virCapsPtr caps) int rv = -1; VIR_FREE(path); - virAsprintf(&path, "%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos); + path = g_strdup_printf("%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos); VIR_DIR_CLOSE(dirp); diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 9cc098a025..34fabcded9 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1388,10 +1388,10 @@ virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr) { char *addrstr = NULL; - virAsprintf(&addrstr, "%x.%x.%04x", - addr->cssid, - addr->ssid, - addr->devno); + addrstr = g_strdup_printf("%x.%x.%04x", + addr->cssid, + addr->ssid, + addr->devno); return addrstr; } diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 2a52e7dc7f..761796e956 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -53,7 +53,7 @@ virDomainAuditGetRdev(const char *path) (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode))) { int maj = major(sb.st_rdev); int min = minor(sb.st_rdev); - virAsprintf(&ret, "%02X:%02X", maj, min); + ret = g_strdup_printf("%02X:%02X", maj, min); } return ret; } @@ -101,8 +101,8 @@ virDomainAuditGenericDev(virDomainObjPtr vm, if (!newsrcpath && !oldsrcpath) return; - virAsprintf(&newdev, "new-%s", type); - virAsprintf(&olddev, "old-%s", type); + newdev = g_strdup_printf("new-%s", type); + olddev = g_strdup_printf("old-%s", type); virUUIDFormat(vm->def->uuid, uuidstr); @@ -373,15 +373,15 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - virAsprintf(&address, - VIR_PCI_DEVICE_ADDRESS_FMT, - pcisrc->addr.domain, - pcisrc->addr.bus, - pcisrc->addr.slot, - pcisrc->addr.function); + address = g_strdup_printf( + VIR_PCI_DEVICE_ADDRESS_FMT, + pcisrc->addr.domain, + pcisrc->addr.bus, + pcisrc->addr.slot, + pcisrc->addr.function); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: - virAsprintf(&address, "%.3d.%.3d", usbsrc->bus, usbsrc->device); + address = g_strdup_printf("%.3d.%.3d", usbsrc->bus, usbsrc->device); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: { if (scsisrc->protocol == @@ -393,10 +393,10 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, } else { virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; - virAsprintf(&address, "%s:%u:%u:%llu", - scsihostsrc->adapter, scsihostsrc->bus, - scsihostsrc->target, - scsihostsrc->unit); + address = g_strdup_printf("%s:%u:%u:%llu", + scsihostsrc->adapter, scsihostsrc->bus, + scsihostsrc->target, + scsihostsrc->unit); } break; } @@ -648,8 +648,8 @@ virDomainAuditCgroupMajor(virDomainObjPtr vm, virCgroupPtr cgroup, { char *extra; - virAsprintf(&extra, "major category=%s maj=%02X acl=%s", - name, maj, perms); + extra = g_strdup_printf("major category=%s maj=%02X acl=%s", + name, maj, perms); virDomainAuditCgroup(vm, cgroup, reason, extra, success); @@ -688,8 +688,8 @@ virDomainAuditCgroupPath(virDomainObjPtr vm, virCgroupPtr cgroup, goto cleanup; } - virAsprintf(&extra, "path %s rdev=%s acl=%s", - detail, VIR_AUDIT_STR(rdev), perms); + extra = g_strdup_printf("path %s rdev=%s acl=%s", + detail, VIR_AUDIT_STR(rdev), perms); virDomainAuditCgroup(vm, cgroup, reason, extra, rc == 0); @@ -926,7 +926,7 @@ virDomainAuditShmem(virDomainObjPtr vm, goto cleanup; } - virAsprintf(&shmpath, "/dev/shm/%s", def->name); + shmpath = g_strdup_printf("/dev/shm/%s", def->name); if (!virt) { VIR_WARN("Unexpected virt type %d while encoding audit message", diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5674032b30..0697000d9f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4911,7 +4911,7 @@ virDomainPostParseCheckISCSIPath(char **srcpath) if (strchr(*srcpath, '/')) return 0; - virAsprintf(&path, "%s/0", *srcpath); + path = g_strdup_printf("%s/0", *srcpath); VIR_FREE(*srcpath); *srcpath = g_steal_pointer(&path); return 0; @@ -5572,7 +5572,7 @@ virDomainDefCollectBootOrder(virDomainDefPtr def G_GNUC_UNUSED, */ return 0; } - virAsprintf(&order, "%u", info->bootIndex); + order = g_strdup_printf("%u", info->bootIndex); if (virHashLookup(bootHash, order)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -10120,8 +10120,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, if (!target && !(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) { if (def->src->srcpool) { - virAsprintf(&tmp, "pool = '%s', volume = '%s'", - def->src->srcpool->pool, def->src->srcpool->volume); + tmp = g_strdup_printf("pool = '%s', volume = '%s'", + def->src->srcpool->pool, def->src->srcpool->volume); virReportError(VIR_ERR_NO_TARGET, "%s", tmp); VIR_FREE(tmp); @@ -10318,7 +10318,7 @@ virDomainParseScaledValue(const char *xpath, g_autofree char *bytes_str = NULL; *val = 0; - virAsprintf(&xpath_full, "string(%s)", xpath); + xpath_full = g_strdup_printf("string(%s)", xpath); bytes_str = virXPathString(xpath_full, ctxt); if (!bytes_str) { @@ -10339,9 +10339,9 @@ virDomainParseScaledValue(const char *xpath, } if (units_xpath) - virAsprintf(&xpath_full, "string(%s)", units_xpath); + xpath_full = g_strdup_printf("string(%s)", units_xpath); else - virAsprintf(&xpath_full, "string(%s/@unit)", xpath); + xpath_full = g_strdup_printf("string(%s/@unit)", xpath); unit = virXPathString(xpath_full, ctxt); if (virScaleInteger(&bytes, unit, scale, max) < 0) @@ -19370,7 +19370,7 @@ virDomainResctrlMonDefParse(virDomainDefPtr def, if (!(tmp = virBitmapFormat(domresmon->vcpus))) goto cleanup; - virAsprintf(&id, "vcpus_%s", tmp); + id = g_strdup_printf("vcpus_%s", tmp); } virResctrlMonitorSetAlloc(domresmon->instance, resctrl->alloc); @@ -19420,7 +19420,7 @@ virDomainResctrlNew(xmlNodePtr node, * directory, so it's nice to have it named appropriately. For now it's * 'vcpus_...' but it's designed in order for it to be changeable in the * future (it's part of the status XML). */ - virAsprintf(&alloc_id, "vcpus_%s", vcpus_str); + alloc_id = g_strdup_printf("vcpus_%s", vcpus_str); } if (virResctrlAllocSetID(alloc, alloc_id) < 0) @@ -24022,7 +24022,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, virStorageNetProtocolTypeToString(src->protocol)); if (src->volume) - virAsprintf(&path, "%s/%s", src->volume, src->path); + path = g_strdup_printf("%s/%s", src->volume, src->path); virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path); @@ -29189,7 +29189,7 @@ char { char *ret; - virAsprintf(&ret, "%s/%s.xml", dir, name); + ret = g_strdup_printf("%s/%s.xml", dir, name); return ret; } @@ -30339,7 +30339,7 @@ virDomainDefGetShortName(const virDomainDef *def) len = mbstowcs(NULL, def->name, 0); if ((len == (size_t) -1 && errno == EILSEQ) || len == strlen(def->name)) { - virAsprintf(&ret, "%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, def->name); + ret = g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, def->name); return ret; } @@ -30375,7 +30375,7 @@ virDomainDefGetShortName(const virDomainDef *def) return NULL; } - virAsprintf(&ret, "%d-%s", def->id, shortname); + ret = g_strdup_printf("%d-%s", def->id, shortname); return ret; } @@ -31181,8 +31181,8 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def, } /* iscsi pool has only one source device path */ - virAsprintf(&def->src->path, "%s/%s", pooldef->source.devices[0].path, - tokens[3]); + def->src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path, + tokens[3]); /* Storage pool have not supported these 2 attributes yet, * use the defaults. diff --git a/src/conf/moment_conf.c b/src/conf/moment_conf.c index f11ba76dd4..d02fcb89e2 100644 --- a/src/conf/moment_conf.c +++ b/src/conf/moment_conf.c @@ -78,7 +78,7 @@ virDomainMomentDefPostParse(virDomainMomentDefPtr def) gettimeofday(&tv, NULL); if (!def->name) - virAsprintf(&def->name, "%lld", (long long)tv.tv_sec); + def->name = g_strdup_printf("%lld", (long long)tv.tv_sec); def->creationTime = tv.tv_sec; return 0; diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 8d2bef439b..61778f561a 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2756,7 +2756,7 @@ virNetworkConfigFile(const char *dir, { char *ret = NULL; - virAsprintf(&ret, "%s/%s.xml", dir, name); + ret = g_strdup_printf("%s/%s.xml", dir, name); return ret; } diff --git a/src/conf/node_device_util.c b/src/conf/node_device_util.c index 6c7b73384f..d8f4a48225 100644 --- a/src/conf/node_device_util.c +++ b/src/conf/node_device_util.c @@ -182,7 +182,7 @@ virNodeDeviceDeleteVport(virConnectPtr conn, goto cleanup; } - virAsprintf(&scsi_host_name, "scsi_%s", name); + scsi_host_name = g_strdup_printf("scsi_%s", name); /* If at startup time we provided a parent, then use that to * get the parent_host value; otherwise, we have to determine diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 2c53e9d764..43a4ae0173 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -618,7 +618,7 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapshotDefPtr def) if ((tmp = strrchr(tmppath, '.')) && !strchr(tmp, '/')) *tmp = '\0'; - virAsprintf(&disk->src->path, "%s.%s", tmppath, def->parent.name); + disk->src->path = g_strdup_printf("%s.%s", tmppath, def->parent.name); VIR_FREE(tmppath); diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index ec9db7edb0..e03a9460fe 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -953,9 +953,9 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) * path and permissions */ if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) { if (def->type == VIR_STORAGE_POOL_LOGICAL) { - virAsprintf(&target_path, "/dev/%s", def->source.name); + target_path = g_strdup_printf("/dev/%s", def->source.name); } else if (def->type == VIR_STORAGE_POOL_ZFS) { - virAsprintf(&target_path, "/dev/zvol/%s", def->source.name); + target_path = g_strdup_printf("/dev/zvol/%s", def->source.name); } else { target_path = virXPathString("string(./target/path)", ctxt); if (!target_path) { diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 204813c5fd..4b8f526d35 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -88,7 +88,7 @@ static char *virChrdevLockFilePath(const char *dev) ++p; } - virAsprintf(&path, "%s/LCK..%s", VIR_CHRDEV_LOCK_FILE_PATH, filename); + path = g_strdup_printf("%s/LCK..%s", VIR_CHRDEV_LOCK_FILE_PATH, filename); sanitizedPath = virFileSanitizePath(path); @@ -133,7 +133,7 @@ static int virChrdevLockFileCreate(const char *dev) /* ensure correct format according to filesystem hierarchy standard */ /* http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES */ - virAsprintf(&pidStr, "%10lld\n", (long long)getpid()); + pidStr = g_strdup_printf("%10lld\n", (long long)getpid()); /* create the lock file */ if ((lockfd = open(path, O_WRONLY | O_CREAT | O_EXCL, 00644)) < 0) { diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 852c0a5e43..8fa4de8203 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1627,7 +1627,7 @@ virNetworkObjGetPortStatusDir(virNetworkObjPtr net, const char *stateDir) { char *ret; - virAsprintf(&ret, "%s/%s/ports", stateDir, net->def->name); + ret = g_strdup_printf("%s/%s/ports", stateDir, net->def->name); return ret; } @@ -1739,7 +1739,7 @@ virNetworkObjDeleteAllPorts(virNetworkObjPtr net, if (!virStringStripSuffix(de->d_name, ".xml")) continue; - virAsprintf(&file, "%s/%s.xml", dir, de->d_name); + file = g_strdup_printf("%s/%s.xml", dir, de->d_name); if (unlink(file) < 0 && errno != ENOENT) VIR_WARN("Unable to delete %s", file); @@ -1899,7 +1899,7 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net, if (!virStringStripSuffix(de->d_name, ".xml")) continue; - virAsprintf(&file, "%s/%s.xml", dir, de->d_name); + file = g_strdup_printf("%s/%s.xml", dir, de->d_name); portdef = virNetworkPortDefParseFile(file); VIR_FREE(file); diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 09bd25a9ef..e511bb483f 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -428,7 +428,7 @@ virNetworkPortDefConfigFile(const char *dir, { char *ret = NULL; - virAsprintf(&ret, "%s/%s.xml", dir, name); + ret = g_strdup_printf("%s/%s.xml", dir, name); return ret; } diff --git a/src/conf/virnwfilterbindingobj.c b/src/conf/virnwfilterbindingobj.c index 0066faadd8..646e1e5782 100644 --- a/src/conf/virnwfilterbindingobj.c +++ b/src/conf/virnwfilterbindingobj.c @@ -142,7 +142,7 @@ virNWFilterBindingObjConfigFile(const char *dir, { char *ret; - virAsprintf(&ret, "%s/%s.xml", dir, name); + ret = g_strdup_printf("%s/%s.xml", dir, name); return ret; } diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 15c5f2624d..5cbd30f93c 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1229,7 +1229,7 @@ matchFCHostToSCSIHost(virStorageAdapterFCHostPtr fchost, */ if (!fchost->parent && (conn = virGetConnectNodeDev())) { - virAsprintf(&scsi_host_name, "scsi_%s", name); + scsi_host_name = g_strdup_printf("scsi_%s", name); if ((parent_name = virNodeDeviceGetParentName(conn, scsi_host_name))) { if (virStorageIsSameHostnum(parent_name, scsi_hostnum)) { -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list