[PATCH 11/32] cpu: use g_auto() for all virBuffers

Laine Stump laine at redhat.com
Mon Jul 6 03:41:06 UTC 2020


Signed-off-by: Laine Stump <laine at redhat.com>
---
 src/cpu/cpu_map.c | 2 +-
 src/cpu/cpu_x86.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 4465ebfa7b..d14488f8aa 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -171,7 +171,7 @@ int cpuMapLoad(const char *arch,
 {
     xmlDocPtr xml = NULL;
     xmlXPathContextPtr ctxt = NULL;
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     char *xpath = NULL;
     int ret = -1;
     char *mapfile;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index bf26cf4e76..1e5cd93abb 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -972,7 +972,7 @@ x86FeatureNames(virCPUx86MapPtr map,
                 const char *separator,
                 virCPUx86Data *data)
 {
-    virBuffer ret = VIR_BUFFER_INITIALIZER;
+    g_auto(virBuffer) ret = VIR_BUFFER_INITIALIZER;
     bool first = true;
     size_t i;
 
@@ -1208,7 +1208,7 @@ virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs,
 static char *
 virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs)
 {
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     size_t i;
 
     if (!sigs)
@@ -1707,7 +1707,7 @@ virCPUx86DataFormat(const virCPUData *data)
 {
     virCPUx86DataIterator iter;
     virCPUx86DataItemPtr item;
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     virCPUx86DataIteratorInit(&iter, &data->data.x86);
 
-- 
2.25.4




More information about the libvir-list mailing list