mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Using the new 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. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. When a variable of type virBitmapPtr is declared using VIR_AUTOPTR, the function virBitmapFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
c450b55a65
commit
a3c915e662
@ -31,7 +31,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "virbitmap.h"
|
||||
#include "viralloc.h"
|
||||
#include "virbuffer.h"
|
||||
#include "c-ctype.h"
|
||||
#include "count-one-bits.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
# define __BITMAP_H__
|
||||
|
||||
# include "internal.h"
|
||||
# include "viralloc.h"
|
||||
|
||||
# include <sys/types.h>
|
||||
|
||||
@ -155,4 +156,6 @@ void virBitmapSubtract(virBitmapPtr a, virBitmapPtr b)
|
||||
|
||||
void virBitmapShrink(virBitmapPtr map, size_t b);
|
||||
|
||||
VIR_DEFINE_AUTOPTR_FUNC(virBitmap, virBitmapFree)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user