mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
tests: use g_auto for all virBuffers
Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b8b58e22b9
commit
25c23b95b6
@ -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;
|
||||
}
|
||||
|
@ -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)) ||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 "/");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user