mirror of
https://github.com/libvirt/libvirt.git
synced 2025-01-08 07:03:19 -06: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;
|
||||
|
||||
error:
|
||||
virSystemdActivationFree(&act);
|
||||
virSystemdActivationFree(act);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1046,12 +1046,12 @@ virSystemdActivationClaimFDs(virSystemdActivationPtr act,
|
||||
* associated with the activation object
|
||||
*/
|
||||
void
|
||||
virSystemdActivationFree(virSystemdActivationPtr *act)
|
||||
virSystemdActivationFree(virSystemdActivationPtr act)
|
||||
{
|
||||
if (!*act)
|
||||
if (!act)
|
||||
return;
|
||||
|
||||
virHashFree((*act)->fds);
|
||||
virHashFree(act->fds);
|
||||
|
||||
VIR_FREE(*act);
|
||||
VIR_FREE(act);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "internal.h"
|
||||
#include "virautoclean.h"
|
||||
|
||||
typedef struct _virSystemdActivation virSystemdActivation;
|
||||
typedef virSystemdActivation *virSystemdActivationPtr;
|
||||
@ -81,6 +82,6 @@ void virSystemdActivationClaimFDs(virSystemdActivationPtr act,
|
||||
int **fds,
|
||||
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) {
|
||||
fprintf(stderr, "Unexpectedly got activation object");
|
||||
virSystemdActivationFree(&act);
|
||||
virSystemdActivationFree(act);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user