mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
util: convert virSystemdActivation to use VIR_DEFINE_AUTOPTR_FUNC
Using the standard macro will facilitate the conversion to glib's auto cleanup macros. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
bb9a1a14e2
commit
74d9326795
@ -917,7 +917,7 @@ virSystemdActivationNew(virSystemdActivationMap *map,
|
|||||||
return act;
|
return act;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virSystemdActivationFree(&act);
|
virSystemdActivationFree(act);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1046,12 +1046,12 @@ virSystemdActivationClaimFDs(virSystemdActivationPtr act,
|
|||||||
* associated with the activation object
|
* associated with the activation object
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
virSystemdActivationFree(virSystemdActivationPtr *act)
|
virSystemdActivationFree(virSystemdActivationPtr act)
|
||||||
{
|
{
|
||||||
if (!*act)
|
if (!act)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
virHashFree((*act)->fds);
|
virHashFree(act->fds);
|
||||||
|
|
||||||
VIR_FREE(*act);
|
VIR_FREE(act);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "virautoclean.h"
|
||||||
|
|
||||||
typedef struct _virSystemdActivation virSystemdActivation;
|
typedef struct _virSystemdActivation virSystemdActivation;
|
||||||
typedef virSystemdActivation *virSystemdActivationPtr;
|
typedef virSystemdActivation *virSystemdActivationPtr;
|
||||||
@ -81,6 +82,6 @@ void virSystemdActivationClaimFDs(virSystemdActivationPtr act,
|
|||||||
int **fds,
|
int **fds,
|
||||||
size_t *nfds);
|
size_t *nfds);
|
||||||
|
|
||||||
void virSystemdActivationFree(virSystemdActivationPtr *act);
|
void virSystemdActivationFree(virSystemdActivationPtr act);
|
||||||
|
|
||||||
#define virSystemdActivationAutoPtrFree virSystemdActivationFree
|
VIR_DEFINE_AUTOPTR_FUNC(virSystemdActivation, virSystemdActivationFree);
|
||||||
|
@ -650,7 +650,7 @@ testActivationEmpty(const void *opaque ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
if (act != NULL) {
|
if (act != NULL) {
|
||||||
fprintf(stderr, "Unexpectedly got activation object");
|
fprintf(stderr, "Unexpectedly got activation object");
|
||||||
virSystemdActivationFree(&act);
|
virSystemdActivationFree(act);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user