render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
0a7476
From 1e01bd7d0102dac3c2a69c95f39de80080973206 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <1e01bd7d0102dac3c2a69c95f39de80080973206@dist-git>
0a7476
From: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
0a7476
Date: Tue, 4 Jun 2019 16:22:03 +0200
0a7476
Subject: [PATCH] util: bitmap: define cleanup function using
0a7476
 VIR_DEFINE_AUTOPTR_FUNC
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
0a7476
src/util/viralloc.h, define a new wrapper around an existing
0a7476
cleanup function which will be called when a variable declared
0a7476
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
0a7476
viralloc.h include, since that has moved from the source module into the
0a7476
header.
0a7476
0a7476
When a variable of type virBitmapPtr is declared using
0a7476
VIR_AUTOPTR, the function virBitmapFree will be run
0a7476
automatically on it when it goes out of scope.
0a7476
0a7476
Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
0a7476
Reviewed-by: Erik Skultety <eskultet@redhat.com>
0a7476
(cherry picked from commit a3c915e662f8c25cac683e20bbc419b497555e13)
0a7476
0a7476
https://bugzilla.redhat.com/show_bug.cgi?id=1703661
0a7476
0a7476
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
0a7476
Message-Id: <20190604142207.2036-3-abologna@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
---
0a7476
 src/util/virbitmap.c | 1 -
0a7476
 src/util/virbitmap.h | 3 +++
0a7476
 2 files changed, 3 insertions(+), 1 deletion(-)
0a7476
0a7476
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
0a7476
index 0bc0d068bb..d6715025d4 100644
0a7476
--- a/src/util/virbitmap.c
0a7476
+++ b/src/util/virbitmap.c
0a7476
@@ -31,7 +31,6 @@
0a7476
 #include <sys/types.h>
0a7476
 
0a7476
 #include "virbitmap.h"
0a7476
-#include "viralloc.h"
0a7476
 #include "virbuffer.h"
0a7476
 #include "c-ctype.h"
0a7476
 #include "count-one-bits.h"
0a7476
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
0a7476
index 2464814055..312e7e2933 100644
0a7476
--- a/src/util/virbitmap.h
0a7476
+++ b/src/util/virbitmap.h
0a7476
@@ -25,6 +25,7 @@
0a7476
 # define __BITMAP_H__
0a7476
 
0a7476
 # include "internal.h"
0a7476
+# include "viralloc.h"
0a7476
 
0a7476
 # include <sys/types.h>
0a7476
 
0a7476
@@ -155,4 +156,6 @@ void virBitmapSubtract(virBitmapPtr a, virBitmapPtr b)
0a7476
 
0a7476
 void virBitmapShrink(virBitmapPtr map, size_t b);
0a7476
 
0a7476
+VIR_DEFINE_AUTOPTR_FUNC(virBitmap, virBitmapFree)
0a7476
+
0a7476
 #endif
0a7476
-- 
0a7476
2.21.0
0a7476