Signed-off-by: Laine Stump <laine(a)redhat.com>
---
tests/commandtest.c | 3 +--
tests/cputest.c | 2 +-
tests/networkxml2firewalltest.c | 3 +--
tests/nodedevmdevctltest.c | 6 ++----
tests/nwfilterebiptablestest.c | 21 +++++++--------------
tests/nwfilterxml2firewalltest.c | 3 +--
tests/qemublocktest.c | 2 +-
tests/qemucommandutiltest.c | 2 +-
tests/qemumigparamstest.c | 6 ++----
tests/qemumonitorjsontest.c | 9 ++++-----
tests/qemumonitortestutils.c | 2 +-
tests/testutils.c | 2 +-
tests/vboxsnapshotxmltest.c | 3 +--
tests/virbuftest.c | 23 ++++++++++-------------
tests/vircgrouptest.c | 3 +--
tests/virfirewalltest.c | 30 ++++++++++--------------------
tests/virhostcputest.c | 3 +--
tests/virkmodtest.c | 4 ++--
tests/virnetdevbandwidthtest.c | 3 +--
19 files changed, 49 insertions(+), 81 deletions(-)
diff --git a/tests/commandtest.c b/tests/commandtest.c
index d5092b7dd0..f0e60ee5fe 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -390,7 +390,7 @@ static int test9(const void *unused G_GNUC_UNUSED)
{
virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
const char* const args[] = { "arg1", "arg2", NULL };
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCommandAddArg(cmd, "-version");
virCommandAddArgPair(cmd, "-log", "bar.log");
@@ -402,7 +402,6 @@ static int test9(const void *unused G_GNUC_UNUSED)
if (virBufferUse(&buf)) {
printf("Buffer not transferred\n");
- virBufferFreeAndReset(&buf);
virCommandFree(cmd);
return -1;
}
diff --git a/tests/cputest.c b/tests/cputest.c
index 0cf6870574..83d63bf495 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -237,7 +237,7 @@ cpuTestGuestCPU(const void *arg)
virCPUDefPtr host = NULL;
virCPUDefPtr cpu = NULL;
virCPUCompareResult cmpResult;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *result = NULL;
if (!(host = cpuTestLoadXML(data->arch, data->host)) ||
diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index 69fadd55c4..29e7d8bc38 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -62,7 +62,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
const char *baseargs)
{
char *actualargv = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virNetworkDefPtr def = NULL;
int ret = -1;
char *actual;
@@ -92,7 +92,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf);
VIR_FREE(actualargv);
virNetworkDefFree(def);
return ret;
diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c
index f5bcf5227d..9780553a3a 100644
--- a/tests/nodedevmdevctltest.c
+++ b/tests/nodedevmdevctltest.c
@@ -54,7 +54,7 @@ testMdevctlStart(const char *virt_type,
{
g_autoptr(virNodeDeviceDef) def = NULL;
virNodeDeviceObjPtr obj = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *actualCmdline = NULL;
int ret = -1;
g_autofree char *uuid = NULL;
@@ -87,7 +87,6 @@ testMdevctlStart(const char *virt_type,
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf);
virCommandSetDryRun(NULL, NULL, NULL);
virNodeDeviceObjEndAPI(&obj);
return ret;
@@ -114,7 +113,7 @@ static int
testMdevctlStop(const void *data)
{
const char *uuid = data;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *actualCmdline = NULL;
int ret = -1;
g_autoptr(virCommand) cmd = NULL;
@@ -140,7 +139,6 @@ testMdevctlStop(const void *data)
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf);
virCommandSetDryRun(NULL, NULL, NULL);
return ret;
}
diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c
index 3e6c335d4e..4d8791023c 100644
--- a/tests/nwfilterebiptablestest.c
+++ b/tests/nwfilterebiptablestest.c
@@ -68,7 +68,7 @@
static int
testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
VIR_NWFILTER_NEW_RULES_TEARDOWN
"iptables -D libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet0
-g FO-vnet0\n"
@@ -120,7 +120,6 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -129,7 +128,7 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
"iptables -D libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet0
-g FO-vnet0\n"
"iptables -D libvirt-out -m physdev --physdev-out vnet0 -g FO-vnet0\n"
@@ -188,7 +187,6 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -197,7 +195,7 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
"ebtables -t nat -D PREROUTING -i vnet0 -j libvirt-I-vnet0\n"
"ebtables -t nat -D POSTROUTING -o vnet0 -j libvirt-O-vnet0\n"
@@ -234,7 +232,6 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque
G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -243,7 +240,7 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque
G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
VIR_NWFILTER_NEW_RULES_TEARDOWN;
char *actual = NULL;
@@ -265,7 +262,6 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -274,7 +270,7 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
VIR_NWFILTER_NEW_RULES_TEARDOWN
"iptables -D libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet0
-g FO-vnet0\n"
@@ -334,7 +330,6 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque
G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -343,7 +338,7 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque
G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
VIR_NWFILTER_NEW_RULES_TEARDOWN
"iptables -D libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet0
-g FO-vnet0\n"
@@ -421,7 +416,6 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque
G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
@@ -431,7 +425,7 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque
G_GNUC_UNUSED)
static int
testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *expected =
VIR_NWFILTER_NEW_RULES_TEARDOWN
"iptables -D libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet0
-g FO-vnet0\n"
@@ -491,7 +485,6 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque
G_GNUC_UNUSED)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual);
return ret;
}
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index da86ec9463..dff2b62028 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -368,7 +368,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline)
{
char *actualargv = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virHashTablePtr vars = virNWFilterHashTableCreate(0);
virNWFilterInst inst;
int ret = -1;
@@ -403,7 +403,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf);
VIR_FREE(actualargv);
virNWFilterInstReset(&inst);
virHashFree(vars);
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 0ab599dd67..51283793e9 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -383,7 +383,7 @@ static int
testQemuDiskXMLToPropsValidateFile(const void *opaque)
{
struct testQemuDiskXMLToJSONData *data = (void *) opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *jsonpath = NULL;
g_autofree char *actual = NULL;
size_t i;
diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c
index 049fd2f0b0..305f59e76b 100644
--- a/tests/qemucommandutiltest.c
+++ b/tests/qemucommandutiltest.c
@@ -38,7 +38,7 @@ testQemuCommandBuildFromJSON(const void *opaque)
{
const testQemuCommandBuildObjectFromJSONData *data = opaque;
virJSONValuePtr val = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *result = NULL;
int ret = -1;
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index 954cd1c578..057cde5e72 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -58,7 +58,7 @@ static int
qemuMigParamsTestXML2XML(const void *opaque)
{
const qemuMigParamsData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *xmlFile = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL;
@@ -89,7 +89,6 @@ qemuMigParamsTestXML2XML(const void *opaque)
VIR_FREE(xmlFile);
VIR_FREE(actualXML);
qemuMigrationParamsFree(migParams);
- virBufferFreeAndReset(&buf);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(doc);
return ret;
@@ -100,7 +99,7 @@ static int
qemuMigParamsTestXML(const void *opaque)
{
const qemuMigParamsData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *replyFile = NULL;
char *xmlFile = NULL;
qemuMonitorTestPtr mon = NULL;
@@ -140,7 +139,6 @@ qemuMigParamsTestXML(const void *opaque)
VIR_FREE(actualXML);
virJSONValueFree(params);
qemuMigrationParamsFree(migParams);
- virBufferFreeAndReset(&buf);
qemuMonitorTestFree(mon);
return ret;
}
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index d2cd054dbf..741e36a491 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2603,7 +2603,7 @@ static char *
testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
size_t nvcpus)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
qemuMonitorCPUInfoPtr vcpu;
size_t i;
@@ -2781,7 +2781,7 @@ testBlockNodeNameDetect(const void *opaque)
virJSONValuePtr namedNodesJson = NULL;
virJSONValuePtr blockstatsJson = NULL;
virHashTablePtr nodedata = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int ret = -1;
resultFile = g_strdup_printf("%s/%s%s.result", abs_srcdir, pathprefix,
@@ -2855,7 +2855,7 @@ static int
testQAPISchemaValidate(const void *opaque)
{
const struct testQAPISchemaData *data = opaque;
- virBuffer debug = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
virJSONValuePtr schemaroot;
virJSONValuePtr json = NULL;
int ret = -1;
@@ -2883,7 +2883,6 @@ testQAPISchemaValidate(const void *opaque)
cleanup:
- virBufferFreeAndReset(&debug);
virJSONValueFree(json);
return ret;
}
@@ -2918,7 +2917,7 @@ testQueryJobs(const void *opaque)
g_autofree char *filenameResult = NULL;
g_autofree char *actual = NULL;
qemuMonitorJobInfoPtr *jobs = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t njobs = 0;
size_t i;
int ret = -1;
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 6be7555dc0..180ac15a15 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -133,7 +133,7 @@ static int
qemuMonitorTestAddErrorResponseInternal(qemuMonitorTestPtr test,
const char *usermsg)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *escapemsg = NULL;
g_autofree char *jsonmsg = NULL;
char *tmp;
diff --git a/tests/testutils.c b/tests/testutils.c
index 7f1776b244..a1cd093e4e 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -251,7 +251,7 @@ static char *
virTestLoadFileGetPath(const char *p,
va_list ap)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *path = NULL;
virBufferAddLit(&buf, abs_srcdir "/");
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index 2ea460d8bd..054e2a8e0d 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -18,7 +18,7 @@ GRegex *testSnapshotXMLVariableLineRegex = NULL;
static char *
testFilterXML(char *xml)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char **xmlLines = NULL;
char **xmlLine;
char *ret = NULL;
@@ -39,7 +39,6 @@ testFilterXML(char *xml)
ret = virBufferContentAndReset(&buf);
cleanup:
- virBufferFreeAndReset(&buf);
virStringListFree(xmlLines);
return ret;
}
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index f9d19ff1a1..39ae7c2b9d 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -17,7 +17,7 @@ struct testBufAddStrData {
static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
{
- virBuffer bufinit = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) bufinit = VIR_BUFFER_INITIALIZER;
virBufferPtr buf = &bufinit;
const char expected[] =
" 1\n 2\n 3\n 4\n 5\n 6\n 7\n &\n 8\n 9\n 10\n '
11'\n";
@@ -96,7 +96,7 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
static int testBufTrim(const void *data G_GNUC_UNUSED)
{
- virBuffer bufinit = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) bufinit = VIR_BUFFER_INITIALIZER;
virBufferPtr buf = NULL;
g_autofree char *result = NULL;
const char *expected = "a,b";
@@ -126,7 +126,6 @@ static int testBufTrim(const void *data G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(buf);
return ret;
}
@@ -134,7 +133,7 @@ static int
testBufTrimChars(const void *opaque)
{
const struct testBufAddStrData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
virBufferAddStr(&buf, data->data);
@@ -156,9 +155,9 @@ testBufTrimChars(const void *opaque)
static int testBufAddBuffer(const void *data G_GNUC_UNUSED)
{
- virBuffer buf1 = VIR_BUFFER_INITIALIZER;
- virBuffer buf2 = VIR_BUFFER_INITIALIZER;
- virBuffer buf3 = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf1 = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf2 = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf3 = VIR_BUFFER_INITIALIZER;
int ret = -1;
g_autofree char *result = NULL;
const char *expected = \
@@ -259,8 +258,6 @@ static int testBufAddBuffer(const void *data G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&buf1);
- virBufferFreeAndReset(&buf2);
return ret;
}
@@ -268,7 +265,7 @@ static int
testBufAddStr(const void *opaque)
{
const struct testBufAddStrData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
virBufferAddLit(&buf, "<c>\n");
@@ -296,7 +293,7 @@ static int
testBufEscapeStr(const void *opaque)
{
const struct testBufAddStrData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
virBufferAddLit(&buf, "<c>\n");
@@ -324,7 +321,7 @@ static int
testBufEscapeRegex(const void *opaque)
{
const struct testBufAddStrData *data = opaque;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
virBufferEscapeRegex(&buf, "%s", data->data);
@@ -347,7 +344,7 @@ testBufEscapeRegex(const void *opaque)
static int
testBufSetIndent(const void *opaque G_GNUC_UNUSED)
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
virBufferSetIndent(&buf, 11);
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 2d6f52fb6e..44e72cbfa9 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -184,7 +184,7 @@ testCgroupDetectMounts(const void *args)
char *parsed = NULL;
const char *actual;
virCgroupPtr group = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
g_setenv("VIR_CGROUP_MOCK_FILENAME", data->file, TRUE);
@@ -218,7 +218,6 @@ testCgroupDetectMounts(const void *args)
g_unsetenv("VIR_CGROUP_MOCK_FILENAME");
VIR_FREE(parsed);
virCgroupFree(&group);
- virBufferFreeAndReset(&buf);
return result;
}
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index c4827918c3..4105c1867e 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -199,7 +199,7 @@ struct testFirewallData {
static int
testFirewallSingleGroup(const void *opaque)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -244,7 +244,6 @@ testFirewallSingleGroup(const void *opaque)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -255,7 +254,7 @@ testFirewallSingleGroup(const void *opaque)
static int
testFirewallRemoveRule(const void *opaque)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -307,7 +306,6 @@ testFirewallRemoveRule(const void *opaque)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -318,7 +316,7 @@ testFirewallRemoveRule(const void *opaque)
static int
testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -377,7 +375,6 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -409,7 +406,7 @@ testFirewallRollbackHook(const char *const*args,
static int
testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -470,7 +467,6 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -481,7 +477,7 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
static int
testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -541,7 +537,6 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -552,7 +547,7 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
static int
testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -606,7 +601,6 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -616,7 +610,7 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
static int
testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -690,7 +684,6 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -700,7 +693,7 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
static int
testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -777,7 +770,6 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -787,7 +779,7 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
static int
testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -894,7 +886,6 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
@@ -981,7 +972,7 @@ testFirewallQueryCallback(virFirewallPtr fw,
static int
testFirewallQuery(const void *opaque G_GNUC_UNUSED)
{
- virBuffer cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
virFirewallPtr fw = NULL;
int ret = -1;
const char *actual = NULL;
@@ -1073,7 +1064,6 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virBufferFreeAndReset(&cmdbuf);
fwBuf = NULL;
virCommandSetDryRun(NULL, NULL, NULL);
virFirewallFree(fw);
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index 62bacddefb..7b83c7ae5d 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -112,7 +112,7 @@ linuxCPUStatsCompareFiles(const char *cpustatfile,
char *actualData = NULL;
FILE *cpustat = NULL;
virNodeCPUStatsPtr params = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
int nparams = 0;
@@ -153,7 +153,6 @@ linuxCPUStatsCompareFiles(const char *cpustatfile,
ret = 0;
fail:
- virBufferFreeAndReset(&buf);
VIR_FORCE_FCLOSE(cpustat);
VIR_FREE(actualData);
VIR_FREE(params);
diff --git a/tests/virkmodtest.c b/tests/virkmodtest.c
index 3ba8c542d1..369eb8baca 100644
--- a/tests/virkmodtest.c
+++ b/tests/virkmodtest.c
@@ -60,7 +60,7 @@ testKModLoad(const void *args G_GNUC_UNUSED)
{
int ret = -1;
char *errbuf = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCommandSetDryRun(&buf, NULL, NULL);
@@ -87,7 +87,7 @@ testKModUnload(const void *args G_GNUC_UNUSED)
{
int ret = -1;
char *errbuf = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCommandSetDryRun(&buf, NULL, NULL);
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 8039fedbc4..5cbdd6ffea 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -70,7 +70,7 @@ testVirNetDevBandwidthSet(const void *data)
const struct testSetStruct *info = data;
const char *iface = info->iface;
virNetDevBandwidthPtr band = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *actual_cmd = NULL;
PARSE(info->band, band);
@@ -99,7 +99,6 @@ testVirNetDevBandwidthSet(const void *data)
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
virNetDevBandwidthFree(band);
- virBufferFreeAndReset(&buf);
VIR_FREE(actual_cmd);
return ret;
}
--
2.25.4