Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libxl/libxl_logger.c | 2 +-
src/qemu/qemu_domain.c | 4 ++--
src/util/viraudit.c | 2 +-
src/util/vircommand.c | 4 ++--
src/util/virerror.c | 4 ++--
src/util/virfile.c | 18 +++++++++---------
src/util/virfirewall.c | 2 +-
src/util/virlog.c | 2 +-
tests/eventtest.c | 2 +-
tests/qemumonitortestutils.c | 2 +-
tools/virt-host-validate-common.c | 4 ++--
tools/vsh.c | 8 ++++----
12 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c
index 63e2df046f..a829142b2b 100644
--- a/src/libxl/libxl_logger.c
+++ b/src/libxl/libxl_logger.c
@@ -74,7 +74,7 @@ libvirt_vmessage(xentoollog_logger *logger_in,
if (level < lg->minLevel)
return;
- virVasprintf(&message, format, args);
+ message = g_strdup_vprintf(format, args);
/* Should we print to a domain-specific log file? */
if ((start = strstr(message, ": Domain ")) &&
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a2eac8f579..b1fa2d1862 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9396,7 +9396,7 @@ int qemuDomainLogContextWrite(qemuDomainLogContextPtr ctxt,
va_start(argptr, fmt);
- virVasprintf(&message, fmt, argptr);
+ message = g_strdup_vprintf(fmt, argptr);
if (!ctxt->manager &&
lseek(ctxt->writefd, 0, SEEK_END) < 0) {
virReportSystemError(errno, "%s",
@@ -9489,7 +9489,7 @@ qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
va_start(ap, fmt);
- virVasprintf(&message, fmt, ap);
+ message = g_strdup_vprintf(fmt, ap);
VIR_DEBUG("Append log message (vm='%s' message='%s)
stdioLogD=%d",
vm->def->name, message, cfg->stdioLogD);
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 1210ba8c94..20eb3f3621 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -110,7 +110,7 @@ void virAuditSend(virLogSourcePtr source,
#endif
va_start(args, fmt);
- virVasprintf(&str, fmt, args);
+ str = g_strdup_vprintf(fmt, args);
va_end(args);
if (auditlog && str) {
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 4b9e837ff0..e062ac554f 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -1324,7 +1324,7 @@ virCommandAddEnvFormat(virCommandPtr cmd, const char *format, ...)
return;
va_start(list, format);
- virVasprintf(&env, format, list);
+ env = g_strdup_vprintf(format, list);
va_end(list);
virCommandAddEnv(cmd, env);
@@ -1553,7 +1553,7 @@ virCommandAddArgFormat(virCommandPtr cmd, const char *format, ...)
return;
va_start(list, format);
- virVasprintf(&arg, format, list);
+ arg = g_strdup_vprintf(format, list);
va_end(list);
/* Arg plus trailing NULL. */
diff --git a/src/util/virerror.c b/src/util/virerror.c
index a5e43361b8..f569cd363c 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -830,7 +830,7 @@ virRaiseErrorFull(const char *filename,
} else {
va_list ap;
va_start(ap, fmt);
- virVasprintf(&str, fmt, ap);
+ str = g_strdup_vprintf(fmt, ap);
va_end(ap);
}
@@ -1485,7 +1485,7 @@ virLastErrorPrefixMessage(const char *fmt, ...)
va_start(args, fmt);
- virVasprintf(&fmtmsg, fmt, args);
+ fmtmsg = g_strdup_vprintf(fmt, args);
newmsg = g_strdup_printf("%s: %s", fmtmsg, err->message);
diff --git a/src/util/virfile.c b/src/util/virfile.c
index d2407e7068..7382f8e19a 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3374,9 +3374,9 @@ virFileRemoveLastComponent(char *path)
/**
* virFilePrintf:
*
- * A replacement for fprintf() which uses virVasprintf to
- * ensure that portable string format placeholders can be
- * used, since gnulib's fprintf() replacement is not
+ * A replacement for fprintf() which uses g_strdup_vprintf
+ * to ensure that portable string format placeholders can
+ * be used, since gnulib's fprintf() replacement is not
* LGPLV2+ compatible
*/
int virFilePrintf(FILE *fp, const char *msg, ...)
@@ -3387,7 +3387,7 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
va_start(vargs, msg);
- virVasprintf(&str, msg, vargs);
+ str = g_strdup_vprintf(msg, vargs);
ret = strlen(str);
if (fwrite(str, 1, ret, fp) != ret) {
@@ -4147,7 +4147,7 @@ virFileReadValueInt(int *value, const char *format, ...)
va_list ap;
va_start(ap, format);
- virVasprintf(&path, format, ap);
+ path = g_strdup_vprintf(format, ap);
va_end(ap);
if (!virFileExists(path))
@@ -4187,7 +4187,7 @@ virFileReadValueUint(unsigned int *value, const char *format, ...)
va_list ap;
va_start(ap, format);
- virVasprintf(&path, format, ap);
+ path = g_strdup_vprintf(format, ap);
va_end(ap);
if (!virFileExists(path))
@@ -4228,7 +4228,7 @@ virFileReadValueScaledInt(unsigned long long *value, const char
*format, ...)
va_list ap;
va_start(ap, format);
- virVasprintf(&path, format, ap);
+ path = g_strdup_vprintf(format, ap);
va_end(ap);
if (!virFileExists(path))
@@ -4271,7 +4271,7 @@ virFileReadValueBitmap(virBitmapPtr *value, const char *format,
...)
va_list ap;
va_start(ap, format);
- virVasprintf(&path, format, ap);
+ path = g_strdup_vprintf(format, ap);
va_end(ap);
if (!virFileExists(path))
@@ -4309,7 +4309,7 @@ virFileReadValueString(char **value, const char *format, ...)
va_list ap;
va_start(ap, format);
- virVasprintf(&path, format, ap);
+ path = g_strdup_vprintf(format, ap);
va_end(ap);
if (!virFileExists(path))
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 55dfc65d0f..ee72b579e4 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -509,7 +509,7 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewall,
VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule);
va_start(list, fmt);
- virVasprintf(&arg, fmt, list);
+ arg = g_strdup_vprintf(fmt, list);
va_end(list);
ADD_ARG(rule, arg);
diff --git a/src/util/virlog.c b/src/util/virlog.c
index d2c7b373cf..c104687ace 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -594,7 +594,7 @@ virLogVMessage(virLogSourcePtr source,
/*
* serialize the error message, add level and timestamp
*/
- virVasprintf(&str, fmt, vargs);
+ str = g_strdup_vprintf(fmt, vargs);
virLogFormatString(&msg, linenr, funcname, priority, str);
diff --git a/tests/eventtest.c b/tests/eventtest.c
index 4c553d5eb7..fdd732f7fa 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -90,7 +90,7 @@ testEventReport(const char *name, bool failed, const char *msg, ...)
struct testEventResultData data;
if (msg)
- virVasprintf(&str, msg, vargs);
+ str = g_strdup_vprintf(msg, vargs);
data.failed = failed;
data.msg = str;
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index c522ee6a83..4ec0e107ab 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -188,7 +188,7 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg,
...)
va_start(msgargs, errmsg);
- virVasprintf(&msg, errmsg, msgargs);
+ msg = g_strdup_vprintf(errmsg, msgargs);
jsonmsg = g_strdup_printf("{ \"error\": " " {
\"desc\": \"%s\", "
" \"class\":
\"UnexpectedCommand\" } }", msg);
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index bc14227864..af8def21f3 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -59,7 +59,7 @@ void virHostMsgCheck(const char *prefix,
return;
va_start(args, format);
- virVasprintf(&msg, format, args);
+ msg = g_strdup_vprintf(format, args);
va_end(args);
fprintf(stdout, _("%6s: Checking %-60s: "), prefix, msg);
@@ -117,7 +117,7 @@ void virHostMsgFail(virHostValidateLevel level,
return;
va_start(args, format);
- virVasprintf(&msg, format, args);
+ msg = g_strdup_vprintf(format, args);
va_end(args);
if (virHostMsgWantEscape())
diff --git a/tools/vsh.c b/tools/vsh.c
index b1d3bcff6d..ce7d80c621 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -1855,7 +1855,7 @@ vshDebug(vshControl *ctl, int level, const char *format, ...)
va_end(ap);
va_start(ap, format);
- virVasprintf(&str, format, ap);
+ str = g_strdup_vprintf(format, ap);
va_end(ap);
fputs(str, stdout);
VIR_FREE(str);
@@ -1871,7 +1871,7 @@ vshPrintExtra(vshControl *ctl, const char *format, ...)
return;
va_start(ap, format);
- virVasprintf(&str, format, ap);
+ str = g_strdup_vprintf(format, ap);
va_end(ap);
fputs(str, stdout);
VIR_FREE(str);
@@ -1885,7 +1885,7 @@ vshPrint(vshControl *ctl G_GNUC_UNUSED, const char *format, ...)
char *str;
va_start(ap, format);
- virVasprintf(&str, format, ap);
+ str = g_strdup_vprintf(format, ap);
va_end(ap);
fputs(str, stdout);
VIR_FREE(str);
@@ -2017,7 +2017,7 @@ vshError(vshControl *ctl, const char *format, ...)
fputs(_("error: "), stderr);
va_start(ap, format);
- virVasprintf(&str, format, ap);
+ str = g_strdup_vprintf(format, ap);
va_end(ap);
fprintf(stderr, "%s\n", NULLSTR(str));
--
2.21.0