mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: Introduce virCPUDefStealModel
The function moves CPU model related parts from one CPU definition to another. It can be used to avoid unnecessary copies from a temporary CPU definitions which will be freed anyway. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
bcf46ddb3f
commit
8e240afccb
@ -115,6 +115,23 @@ virCPUDefCopyModel(virCPUDefPtr dst,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virCPUDefStealModel(virCPUDefPtr dst,
|
||||
virCPUDefPtr src)
|
||||
{
|
||||
virCPUDefFreeModel(dst);
|
||||
|
||||
VIR_STEAL_PTR(dst->model, src->model);
|
||||
VIR_STEAL_PTR(dst->vendor, src->vendor);
|
||||
VIR_STEAL_PTR(dst->vendor_id, src->vendor_id);
|
||||
VIR_STEAL_PTR(dst->features, src->features);
|
||||
dst->nfeatures_max = src->nfeatures_max;
|
||||
src->nfeatures_max = 0;
|
||||
dst->nfeatures = src->nfeatures;
|
||||
src->nfeatures = 0;
|
||||
}
|
||||
|
||||
|
||||
virCPUDefPtr
|
||||
virCPUDefCopyWithoutModel(const virCPUDef *cpu)
|
||||
{
|
||||
|
@ -123,6 +123,10 @@ virCPUDefCopyModel(virCPUDefPtr dst,
|
||||
const virCPUDef *src,
|
||||
bool resetPolicy);
|
||||
|
||||
void
|
||||
virCPUDefStealModel(virCPUDefPtr dst,
|
||||
virCPUDefPtr src);
|
||||
|
||||
virCPUDefPtr
|
||||
virCPUDefCopy(const virCPUDef *cpu);
|
||||
|
||||
|
@ -72,6 +72,7 @@ virCPUDefFormatBuf;
|
||||
virCPUDefFree;
|
||||
virCPUDefFreeModel;
|
||||
virCPUDefParseXML;
|
||||
virCPUDefStealModel;
|
||||
virCPUDefUpdateFeature;
|
||||
virCPUModeTypeToString;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user