virCPUDefFormatBufFull: Use virXMLFormatElement

The function was basically open-coding it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-30 17:45:07 +01:00
parent 20feb62ed8
commit dddd442798

View File

@ -743,21 +743,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
if (virDomainNumaDefFormatXML(&childrenBuf, numa) < 0)
return -1;
/* Put it all together */
if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) {
virBufferAddLit(buf, "<cpu");
if (virBufferUse(&attributeBuf))
virBufferAddBuffer(buf, &attributeBuf);
if (virBufferUse(&childrenBuf)) {
virBufferAddLit(buf, ">\n");
virBufferAddBuffer(buf, &childrenBuf);
virBufferAddLit(buf, "</cpu>\n");
} else {
virBufferAddLit(buf, "/>\n");
}
}
virXMLFormatElement(buf, "cpu", &attributeBuf, &childrenBuf);
return 0;
}