util: Move VIR_AUTOUNREF definition to virobject.h

This helper has solely to do with virObjects. Move it together with
other virObject stuff.

This also avoids the potential problem where VIR_AUTOUNREF uses
virObjectAutoUnref which is defined in virobject.h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-04-03 13:37:26 +02:00
parent dfa0011826
commit 5cd017d563
2 changed files with 10 additions and 11 deletions

View File

@ -682,15 +682,4 @@ void virAllocTestHook(void (*func)(int, void*), void *data);
# define VIR_AUTOCLEAN(type) \
__attribute__((cleanup(VIR_AUTOCLEAN_FUNC_NAME(type)))) type
/**
* VIR_AUTOUNREF:
* @type: type of an virObject subclass to be unref'd automatically
*
* Declares a variable of @type which will be automatically unref'd when
* control goes out of the scope.
*/
# define VIR_AUTOUNREF(type) \
__attribute__((cleanup(virObjectAutoUnref))) type
#endif /* LIBVIRT_VIRALLOC_H */

View File

@ -113,6 +113,16 @@ virObjectUnref(void *obj);
void
virObjectAutoUnref(void *objptr);
/**
* VIR_AUTOUNREF:
* @type: type of an virObject subclass to be unref'd automatically
*
* Declares a variable of @type which will be automatically unref'd when
* control goes out of the scope.
*/
# define VIR_AUTOUNREF(type) \
__attribute__((cleanup(virObjectAutoUnref))) type
void *
virObjectRef(void *obj);