cpu_conf: Introduce virCPUDefFreeFeatures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2017-03-16 12:21:58 +01:00
parent b101101d09
commit 532fc7b773
3 changed files with 19 additions and 6 deletions

View File

@ -62,18 +62,27 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
"disable", "disable",
"forbid") "forbid")
void ATTRIBUTE_NONNULL(1) void
virCPUDefFreeModel(virCPUDefPtr def) virCPUDefFreeFeatures(virCPUDefPtr def)
{ {
size_t i; size_t i;
VIR_FREE(def->model);
VIR_FREE(def->vendor);
VIR_FREE(def->vendor_id);
for (i = 0; i < def->nfeatures; i++) for (i = 0; i < def->nfeatures; i++)
VIR_FREE(def->features[i].name); VIR_FREE(def->features[i].name);
VIR_FREE(def->features); VIR_FREE(def->features);
def->nfeatures = def->nfeatures_max = 0;
}
void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def)
{
VIR_FREE(def->model);
VIR_FREE(def->vendor);
VIR_FREE(def->vendor_id);
virCPUDefFreeFeatures(def);
} }
void void

View File

@ -124,6 +124,9 @@ struct _virCPUDef {
}; };
void ATTRIBUTE_NONNULL(1)
virCPUDefFreeFeatures(virCPUDefPtr def);
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def); virCPUDefFreeModel(virCPUDefPtr def);

View File

@ -75,6 +75,7 @@ virCPUDefCopyWithoutModel;
virCPUDefFormat; virCPUDefFormat;
virCPUDefFormatBuf; virCPUDefFormatBuf;
virCPUDefFree; virCPUDefFree;
virCPUDefFreeFeatures;
virCPUDefFreeModel; virCPUDefFreeModel;
virCPUDefParseXML; virCPUDefParseXML;
virCPUDefStealModel; virCPUDefStealModel;