Using the standard macro will facilitate the conversion to glib's
auto cleanup macros.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/virsystemd.c | 10 +++++-----
src/util/virsystemd.h | 5 +++--
tests/virsystemdtest.c | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 2efc0dd72c..c2e4c3df51 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -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);
}
diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h
index 5f1a4413fe..2c0a0d8dc0 100644
--- a/src/util/virsystemd.h
+++ b/src/util/virsystemd.h
@@ -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);
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 3add1ab56f..d33a7c192f 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -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;
}
--
2.21.0