Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/qemu/qemu_agent.c | 2 +-
src/qemu/qemu_block.c | 2 +-
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_command.c | 4 ++--
src/qemu/qemu_dbus.c | 2 +-
src/qemu/qemu_domain.c | 4 ++--
src/qemu/qemu_driver.c | 5 ++---
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_migration_cookie.c | 6 ++----
src/qemu/qemu_monitor.c | 2 +-
10 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 6fa48c06e3..37b5451e33 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -155,7 +155,7 @@ static char *
qemuAgentEscapeNonPrintable(const char *text)
{
size_t i;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
for (i = 0; text[i] != '\0'; i++) {
if (text[i] == '\\')
virBufferAddLit(&buf, "\\\\");
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index b00694c96f..a727366373 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3271,7 +3271,7 @@ qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource
*src)
char *
qemuBlockStorageSourceGetCookieString(virStorageSourcePtr src)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
for (i = 0; i < src->ncookies; i++) {
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index efc42aac17..0cf9165ecc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4602,7 +4602,7 @@ virQEMUCapsFormatSEVInfo(virQEMUCapsPtr qemuCaps, virBufferPtr buf)
char *
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
virBufferAddLit(&buf, "<qemuCaps>\n");
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6e7fd59561..789c5b8f56 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5477,7 +5477,7 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager,
for (i = 0; i < def->nrngs; i++) {
g_autoptr(virJSONValue) props = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainRNGDefPtr rng = def->rngs[i];
g_autofree char *chardev = NULL;
g_autofree char *devstr = NULL;
@@ -6155,7 +6155,7 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
if (def->os.dtb)
virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
if (def->os.slic_table) {
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCommandAddArg(cmd, "-acpitable");
virBufferAddLit(&buf, "sig=SLIC,file=");
virQEMUBuildBufferEscapeComma(&buf, def->os.slic_table);
diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c
index 53f6c45986..51f6c94e3e 100644
--- a/src/qemu/qemu_dbus.c
+++ b/src/qemu/qemu_dbus.c
@@ -100,7 +100,7 @@ qemuDBusGetAddress(virQEMUDriverPtr driver,
static int
qemuDBusWriteConfig(const char *filename, const char *path)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *config = NULL;
virBufferAddLit(&buf, "<!DOCTYPE busconfig PUBLIC
\"-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN\"\n");
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c5b8d91f9a..03dcdd5766 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4820,7 +4820,7 @@ qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
virQEMUDriverPtr driver)
{
g_autoptr(virQEMUDriverConfig) cfg = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *regexp = NULL;
if (chr->deviceType != VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL ||
@@ -6001,7 +6001,7 @@ qemuDomainDefFormatXMLInternal(virQEMUDriverPtr driver,
virCPUDefPtr origCPU,
unsigned int flags)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (qemuDomainDefFormatBufInternal(driver, qemuCaps, def, origCPU, flags, &buf)
< 0)
return NULL;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a5b38b3d24..247baa9b8d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1272,7 +1272,7 @@ static char *
qemuConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
{
virQEMUDriverPtr driver = conn->privateData;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCheckFlags(0, NULL);
@@ -14398,7 +14398,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
virBitmapPtr created = NULL;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
int ret = -1;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainSnapshotDefPtr snapdef = virDomainSnapshotObjGetDef(snap);
if (!(qemuImgPath = qemuFindQemuImgBinary(driver)))
@@ -14485,7 +14485,6 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf);
virCommandFree(cmd);
/* unlink images if creation has failed */
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 13427c1203..b7dbadb728 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -178,7 +178,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr conn,
virStorageVolPtr vol = NULL;
char *volName = NULL, *basePath = NULL;
char *volStr = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *format = NULL;
unsigned int flags = 0;
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index fb8b5bcd92..2e48d1b524 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -869,12 +869,10 @@ qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
qemuMigrationCookiePtr mig)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0) {
- virBufferFreeAndReset(&buf);
+ if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5033cbeabf..157ebb43e8 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -203,7 +203,7 @@ static char *
qemuMonitorEscapeNonPrintable(const char *text)
{
size_t i;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
for (i = 0; text[i] != '\0'; i++) {
if (g_ascii_isprint(text[i]) ||
text[i] == '\n' ||
--
2.25.4