mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
virDomainMemoryTargetDefFormat: Utilize virXMLFormatElement()
The virDomainMemoryTargetDefFormat() uses good old style of formatting child buffer (virBufferAdjustIndent()). When switched to virXMLFormatElement() we can save a couple of lines Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com> Tested-by: Han Han <hhan@redhat.com>
This commit is contained in:
parent
c81045376c
commit
917006cbb9
@ -27882,24 +27882,21 @@ static void
|
||||
virDomainMemoryTargetDefFormat(virBufferPtr buf,
|
||||
virDomainMemoryDefPtr def)
|
||||
{
|
||||
virBufferAddLit(buf, "<target>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
|
||||
virBufferAsprintf(buf, "<size unit='KiB'>%llu</size>\n", def->size);
|
||||
virBufferAsprintf(&childBuf, "<size unit='KiB'>%llu</size>\n", def->size);
|
||||
if (def->targetNode >= 0)
|
||||
virBufferAsprintf(buf, "<node>%d</node>\n", def->targetNode);
|
||||
virBufferAsprintf(&childBuf, "<node>%d</node>\n", def->targetNode);
|
||||
if (def->labelsize) {
|
||||
virBufferAddLit(buf, "<label>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
virBufferAsprintf(buf, "<size unit='KiB'>%llu</size>\n", def->labelsize);
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</label>\n");
|
||||
g_auto(virBuffer) labelChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf);
|
||||
|
||||
virBufferAsprintf(&labelChildBuf, "<size unit='KiB'>%llu</size>\n", def->labelsize);
|
||||
virXMLFormatElement(&childBuf, "label", NULL, &labelChildBuf);
|
||||
}
|
||||
if (def->readonly)
|
||||
virBufferAddLit(buf, "<readonly/>\n");
|
||||
virBufferAddLit(&childBuf, "<readonly/>\n");
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</target>\n");
|
||||
virXMLFormatElement(buf, "target", NULL, &childBuf);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user