Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vz/vz_driver.c | 2 +-
src/vz/vz_sdk.c | 32 +++++++++++++++-----------------
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index adde179951..54413fdc67 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -2955,7 +2955,7 @@ vzMigrationCreateURI(void)
goto cleanup;
}
- virAsprintf(&uri, "vzmigr://%s", hostname);
+ uri = g_strdup_printf("vzmigr://%s", hostname);
cleanup:
VIR_FREE(hostname);
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 9e2bddf6df..70bbde5e1d 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1213,22 +1213,22 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainChrDefPtr
chr)
break;
case PDT_USE_TCP:
chr->source->type = VIR_DOMAIN_CHR_TYPE_TCP;
- virAsprintf(&uristr, "tcp://%s", friendlyName);
+ uristr = g_strdup_printf("tcp://%s", friendlyName);
if (!(uri = virURIParse(uristr)))
goto cleanup;
chr->source->data.tcp.host = g_strdup(uri->server);
- virAsprintf(&chr->source->data.tcp.service, "%d",
uri->port);
+ chr->source->data.tcp.service = g_strdup_printf("%d",
uri->port);
chr->source->data.tcp.listen = socket_mode == PSP_SERIAL_SOCKET_SERVER;
break;
case PDT_USE_UDP:
chr->source->type = VIR_DOMAIN_CHR_TYPE_UDP;
- virAsprintf(&uristr, "udp://%s", friendlyName);
+ uristr = g_strdup_printf("udp://%s", friendlyName);
if (!(uri = virURIParse(uristr)))
goto cleanup;
chr->source->data.udp.bindHost = g_strdup(uri->server);
- virAsprintf(&chr->source->data.udp.bindService, "%d",
uri->port);
+ chr->source->data.udp.bindService = g_strdup_printf("%d",
uri->port);
chr->source->data.udp.connectHost = g_strdup(uri->server);
- virAsprintf(&chr->source->data.udp.connectService, "%d",
uri->port);
+ chr->source->data.udp.connectService = g_strdup_printf("%d",
uri->port);
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -3123,16 +3123,16 @@ static int prlsdkAddSerial(PRL_HANDLE sdkdom, virDomainChrDefPtr
chr)
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
emutype = PDT_USE_TCP;
- virAsprintf(&url, "%s:%s", chr->source->data.tcp.host,
- chr->source->data.tcp.service);
+ url = g_strdup_printf("%s:%s", chr->source->data.tcp.host,
+ chr->source->data.tcp.service);
if (!chr->source->data.tcp.listen)
socket_mode = PSP_SERIAL_SOCKET_CLIENT;
path = url;
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
emutype = PDT_USE_UDP;
- virAsprintf(&url, "%s:%s", chr->source->data.udp.bindHost,
- chr->source->data.udp.bindService);
+ url = g_strdup_printf("%s:%s", chr->source->data.udp.bindHost,
+ chr->source->data.udp.bindService);
path = url;
break;
default:
@@ -3324,7 +3324,7 @@ static int prlsdkConfigureNet(vzDriverPtr driver G_GNUC_UNUSED,
if (!(tmpstr = virSocketAddrFormat(&net->guestIP.ips[i]->address)))
goto cleanup;
- virAsprintf(&addrstr, "%s/%d", tmpstr,
net->guestIP.ips[i]->prefix);
+ addrstr = g_strdup_printf("%s/%d", tmpstr,
net->guestIP.ips[i]->prefix);
VIR_FREE(tmpstr);
pret = PrlStrList_AddItem(addrlist, addrstr);
@@ -3779,8 +3779,8 @@ prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs)
prlsdkCheckRetGoto(pret, cleanup);
if (fs->type == VIR_DOMAIN_FS_TYPE_VOLUME) {
- virAsprintf(&storage, "libvirt://localhost/%s/%s",
- fs->src->srcpool->pool, fs->src->srcpool->volume);
+ storage = g_strdup_printf("libvirt://localhost/%s/%s",
+ fs->src->srcpool->pool,
fs->src->srcpool->volume);
pret = PrlVmDevHd_SetStorageURL(sdkdisk, storage);
prlsdkCheckRetGoto(pret, cleanup);
}
@@ -4393,8 +4393,7 @@ prlsdkGetBlockStats(PRL_HANDLE sdkstats,
#define PRLSDK_GET_STAT_PARAM(VAL, TYPE, NAME) \
- if (virAsprintf(&name, "devices.%s%d.%s", prefix, idx, NAME) < 0) \
- goto cleanup; \
+ name = g_strdup_printf("devices.%s%d.%s", prefix, idx, NAME); \
if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \
goto cleanup; \
VIR_FREE(name);
@@ -4474,8 +4473,7 @@ prlsdkGetNetStats(PRL_HANDLE sdkstats, PRL_HANDLE sdkdom, const char
*device,
prlsdkCheckRetGoto(pret, cleanup);
#define PRLSDK_GET_NET_COUNTER(VAL, NAME) \
- if (virAsprintf(&name, "net.nic%u.%s", net_index, NAME) < 0) \
- goto cleanup; \
+ name = g_strdup_printf("net.nic%u.%s", net_index, NAME); \
if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \
goto cleanup; \
VIR_FREE(name);
@@ -4506,7 +4504,7 @@ prlsdkGetVcpuStats(PRL_HANDLE sdkstats, int idx, unsigned long long
*vtime)
long long ptime = 0;
int ret = -1;
- virAsprintf(&name, "guest.vcpu%u.time", (unsigned int)idx);
+ name = g_strdup_printf("guest.vcpu%u.time", (unsigned int)idx);
if (prlsdkExtractStatsParam(sdkstats, name, &ptime) < 0)
goto cleanup;
*vtime = ptime == -1 ? 0 : ptime;
--
2.21.0