virCPUDef *cpu,
const char *name)
{
- char *xml = NULL;
- char *actual = NULL;
+ g_autofree char *xml = NULL;
+ g_autofree char *actual = NULL;
int ret = -1;
xml = g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir,
ret = 0;
cleanup:
- VIR_FREE(xml);
- VIR_FREE(actual);
return ret;
}
g_autoptr(virCPUDef) cpu = NULL;
virCPUCompareResult cmpResult;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *result = NULL;
+ g_autofree char *result = NULL;
if (!(host = cpuTestLoadXML(data->arch, data->host)) ||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
ret = 0;
cleanup:
- VIR_FREE(result);
-
if (ret == data->result) {
/* We got the result we expected, whether it was
* a success or a failure */
virCPUDef **cpus = NULL;
virCPUDef *baseline = NULL;
unsigned int ncpus = 0;
- char *result = NULL;
+ g_autofree char *result = NULL;
const char *suffix;
size_t i;
VIR_FREE(cpus);
}
virCPUDefFree(baseline);
- VIR_FREE(result);
return ret;
}
g_autoptr(virCPUDef) host = NULL;
g_autoptr(virCPUDef) migHost = NULL;
g_autoptr(virCPUDef) cpu = NULL;
- char *result = NULL;
+ g_autofree char *result = NULL;
if (!(host = cpuTestLoadXML(data->arch, data->host)) ||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
ret = cpuTestCompareXML(data->arch, cpu, result);
cleanup:
- VIR_FREE(result);
return ret;
}
const struct data *data = arg;
int ret = -1;
g_autoptr(virCPUData) hostData = NULL;
- char *hostFile = NULL;
- char *host = NULL;
+ g_autofree char *hostFile = NULL;
+ g_autofree char *host = NULL;
g_autoptr(virCPUDef) cpu = NULL;
- char *result = NULL;
+ g_autofree char *result = NULL;
virDomainCapsCPUModels *models = NULL;
hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
ret = cpuTestCompareXML(data->arch, cpu, result);
cleanup:
- VIR_FREE(hostFile);
- VIR_FREE(host);
- VIR_FREE(result);
virObjectUnref(models);
return ret;
}
{
const struct data *data = arg;
g_autoptr(virCPUData) hostData = NULL;
- char *hostFile = NULL;
- char *host = NULL;
+ g_autofree char *hostFile = NULL;
+ g_autofree char *host = NULL;
int ret = -1;
hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
ret = cpuTestCompareSignature(data, hostData);
cleanup:
- VIR_FREE(hostFile);
- VIR_FREE(host);
return ret;
}
cpuTestUpdateLive(const void *arg)
{
const struct data *data = arg;
- char *cpuFile = NULL;
+ g_autofree char *cpuFile = NULL;
g_autoptr(virCPUDef) cpu = NULL;
- char *enabledFile = NULL;
- char *enabled = NULL;
+ g_autofree char *enabledFile = NULL;
+ g_autofree char *enabled = NULL;
g_autoptr(virCPUData) enabledData = NULL;
- char *disabledFile = NULL;
- char *disabled = NULL;
+ g_autofree char *disabledFile = NULL;
+ g_autofree char *disabled = NULL;
g_autoptr(virCPUData) disabledData = NULL;
- char *expectedFile = NULL;
+ g_autofree char *expectedFile = NULL;
g_autoptr(virCPUDef) expected = NULL;
virDomainCapsCPUModels *hvModels = NULL;
virDomainCapsCPUModels *models = NULL;
ret = cpuTestUpdateLiveCompare(data->arch, cpu, expected);
cleanup:
- VIR_FREE(cpuFile);
- VIR_FREE(enabledFile);
- VIR_FREE(enabled);
- VIR_FREE(disabledFile);
- VIR_FREE(disabled);
- VIR_FREE(expectedFile);
virObjectUnref(hvModels);
virObjectUnref(models);
return ret;
const struct data *data = arg;
g_autoptr(virQEMUCaps) qemuCaps = NULL;
g_autoptr(virCPUDef) cpu = NULL;
- char *result = NULL;
+ g_autofree char *result = NULL;
int ret = -1;
result = g_strdup_printf("cpuid-%s-json", data->host);
ret = cpuTestCompareXML(data->arch, cpu, result);
cleanup:
- VIR_FREE(result);
return ret;
}
models == NULL ? NULL : #models, \
flags, result \
}; \
- char *testLabel; \
+ g_autofree char *testLabel = NULL; \
\
g_free(virTestLogContentAndReset());\
\
ret = -1; \
} \
\
- VIR_FREE(testLabel); \
} while (0)
#define DO_TEST_COMPARE(arch, host, cpu, result) \
#define DO_TEST_BASELINE(arch, name, flags, result) \
do { \
const char *suffix = ""; \
- char *label; \
+ g_autofree char *label = NULL; \
if ((flags) & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) \
suffix = " (expanded)"; \
if ((flags) & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \
label = g_strdup_printf("%s%s", name, suffix); \
DO_TEST(arch, cpuTestBaseline, label, NULL, \
"baseline-" name, NULL, flags, result); \
- VIR_FREE(label); \
} while (0)
#define DO_TEST_HASFEATURE(arch, host, feature, result) \