[PATCH 16/23] conf: Avoid extra set of temp buffers in virDomainDefFormatFeatures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 605ae3667b..a1ed889e1d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
             }

-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux