[libvirt] [PATCH v1 19/21] util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Sukrit Bhatnagar skrtbhtngr at gmail.com
Thu Jun 7 19:34:41 UTC 2018


Using the VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h,
define a new wrapper around an existing cleanup function which will be
called when a variable declared with VIR_AUTOPTR macro goes out of scope.
---
 src/util/virbitmap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 2464814..86bb84e 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -25,6 +25,7 @@
 # define __BITMAP_H__
 
 # include "internal.h"
+# include "viralloc.h"
 
 # include <sys/types.h>
 
@@ -44,6 +45,8 @@ virBitmapPtr virBitmapNewEmpty(void) ATTRIBUTE_RETURN_CHECK;
  */
 void virBitmapFree(virBitmapPtr bitmap);
 
+VIR_DEFINE_AUTOPTR_FUNC(virBitmapPtr, virBitmapFree)
+
 /*
  * Copy all bits from @src to @dst. The bitmap sizes
  * must be the same
-- 
1.8.3.1




More information about the libvir-list mailing list