提交 8e240afc 编写于 作者: J Jiri Denemark

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: NJiri Denemark <jdenemar@redhat.com>
上级 bcf46ddb
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册