提交 d1164bfd 编写于 作者: P Peter Krempa

conf: Avoid extra set of temp buffers in virDomainDefFormatFeatures

Use the top level set of temp buffers to do the job.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 dc29a467
...@@ -27816,10 +27816,8 @@ virDomainDefFormatFeatures(virBufferPtr buf, ...@@ -27816,10 +27816,8 @@ virDomainDefFormatFeatures(virBufferPtr buf,
case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_SMM:
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT) { if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT) {
virTristateSwitch state = def->features[i]; 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)); virTristateSwitchTypeToString(state));
if (state == VIR_TRISTATE_SWITCH_ON && if (state == VIR_TRISTATE_SWITCH_ON &&
...@@ -27828,12 +27826,12 @@ virDomainDefFormatFeatures(virBufferPtr buf, ...@@ -27828,12 +27826,12 @@ virDomainDefFormatFeatures(virBufferPtr buf,
unsigned long long short_size = virFormatIntPretty(def->tseg_size, unsigned long long short_size = virFormatIntPretty(def->tseg_size,
&unit); &unit);
virBufferSetChildIndent(&childBuf, buf); virBufferSetChildIndent(&tmpChildBuf, buf);
virBufferAsprintf(&childBuf, "<tseg unit='%s'>%llu</tseg>\n", virBufferAsprintf(&tmpChildBuf, "<tseg unit='%s'>%llu</tseg>\n",
unit, short_size); unit, short_size);
} }
if (virXMLFormatElement(buf, "smm", &attrBuf, &childBuf) < 0) if (virXMLFormatElement(buf, "smm", &tmpAttrBuf, &tmpChildBuf) < 0)
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册