conf: Avoid extra set of temp buffers in virDomainDefFormatFeatures

Use the top level set of temp buffers to do the job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-03-05 13:33:05 +01:00
parent dc29a46777
commit d1164bfdca

View File

@ -27816,10 +27816,8 @@ virDomainDefFormatFeatures(virBufferPtr buf,
case VIR_DOMAIN_FEATURE_SMM:
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT) {
virTristateSwitch state = def->features[i];
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&attrBuf, " state='%s'",
virBufferAsprintf(&tmpAttrBuf, " state='%s'",
virTristateSwitchTypeToString(state));
if (state == VIR_TRISTATE_SWITCH_ON &&
@ -27828,12 +27826,12 @@ virDomainDefFormatFeatures(virBufferPtr buf,
unsigned long long short_size = virFormatIntPretty(def->tseg_size,
&unit);
virBufferSetChildIndent(&childBuf, buf);
virBufferAsprintf(&childBuf, "<tseg unit='%s'>%llu</tseg>\n",
virBufferSetChildIndent(&tmpChildBuf, buf);
virBufferAsprintf(&tmpChildBuf, "<tseg unit='%s'>%llu</tseg>\n",
unit, short_size);
}
if (virXMLFormatElement(buf, "smm", &attrBuf, &childBuf) < 0)
if (virXMLFormatElement(buf, "smm", &tmpAttrBuf, &tmpChildBuf) < 0)
return -1;
}