Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/hyperv/hyperv_driver.c | 8 ++++----
src/hyperv/hyperv_wmi.c | 18 ++++++++----------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index eb35cf6115..b1dafe7c80 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1378,9 +1378,9 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int codeset,
}
}
- virAsprintf(&selector,
"CreationClassName=Msvm_Keyboard&DeviceID=%s&"
- "SystemCreationClassName=Msvm_ComputerSystem&"
- "SystemName=%s", keyboard->data.common->DeviceID,
uuid_string);
+ selector =
g_strdup_printf("CreationClassName=Msvm_Keyboard&DeviceID=%s&"
+
"SystemCreationClassName=Msvm_ComputerSystem&"
+ "SystemName=%s",
keyboard->data.common->DeviceID, uuid_string);
/* press the keys */
for (i = 0; i < nkeycodes; i++) {
@@ -1462,7 +1462,7 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long
memory,
virCheckFlags(0, -1);
- virAsprintf(&memory_str, "%lu", memory_mb);
+ memory_str = g_strdup_printf("%lu", memory_mb);
virUUIDFormat(domain->uuid, uuid_string);
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index c0c9b7f77e..2c3e8d4f5e 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -439,7 +439,7 @@ hypervCreateInvokeXmlDoc(hypervInvokeParamsListPtr params, WsXmlDocH
*docRoot)
char *method = NULL;
WsXmlNodeH xmlNodeMethod = NULL;
- virAsprintf(&method, "%s_INPUT", params->method);
+ method = g_strdup_printf("%s_INPUT", params->method);
*docRoot = ws_xml_create_doc(NULL, method);
if (*docRoot == NULL) {
@@ -848,9 +848,8 @@ hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr
params,
params->method, paramsDocRoot);
/* check return code of invocation */
- virAsprintf(&returnValue_xpath,
- "/s:Envelope/s:Body/p:%s_OUTPUT/p:ReturnValue",
- params->method);
+ returnValue_xpath =
g_strdup_printf("/s:Envelope/s:Body/p:%s_OUTPUT/p:ReturnValue",
+ params->method);
returnValue = ws_xml_get_xpath_value(response, returnValue_xpath);
if (!returnValue) {
@@ -864,10 +863,9 @@ hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr
params,
goto cleanup;
if (returnCode == CIM_RETURNCODE_TRANSITION_STARTED) {
- virAsprintf(&jobcode_instance_xpath,
-
"/s:Envelope/s:Body/p:%s_OUTPUT/p:Job/a:ReferenceParameters/"
- "w:SelectorSet/w:Selector[@Name='InstanceID']",
- params->method);
+ jobcode_instance_xpath =
g_strdup_printf("/s:Envelope/s:Body/p:%s_OUTPUT/p:Job/a:ReferenceParameters/"
+
"w:SelectorSet/w:Selector[@Name='InstanceID']",
+ params->method);
instanceID = ws_xml_get_xpath_value(response, jobcode_instance_xpath);
if (!instanceID) {
@@ -1338,8 +1336,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr
domain,
virUUIDFormat(domain->uuid, uuid_string);
- virAsprintf(&selector,
"Name=%s&CreationClassName=Msvm_ComputerSystem", uuid_string);
- virAsprintf(&properties, "RequestedState=%d", requestedState);
+ selector =
g_strdup_printf("Name=%s&CreationClassName=Msvm_ComputerSystem",
uuid_string);
+ properties = g_strdup_printf("RequestedState=%d", requestedState);
if (priv->wmiVersion == HYPERV_WMI_VERSION_V1)
resourceUri = MSVM_COMPUTERSYSTEM_V1_RESOURCE_URI;
--
2.21.0