From 280f4b9415b35faf97e8e672c3b1934a1c46dbb3 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 10 May 2019 12:53:36 -0700 Subject: [PATCH] libsysprof: backport autoptr cleanups when necessary --- src/libsysprof/sysprof-backport-autocleanups.h | 12 ++++++++++++ src/libsysprof/sysprof-helpers.c | 1 + 2 files changed, 13 insertions(+) create mode 100644 src/libsysprof/sysprof-backport-autocleanups.h diff --git a/src/libsysprof/sysprof-backport-autocleanups.h b/src/libsysprof/sysprof-backport-autocleanups.h new file mode 100644 index 00000000..2ff37928 --- /dev/null +++ b/src/libsysprof/sysprof-backport-autocleanups.h @@ -0,0 +1,12 @@ +#pragma once + +#include "config.h" + +#ifndef HAVE_POLKIT_AUTOPTR +# include + + G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAuthority, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAuthorizationResult, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitSubject, g_object_unref) +#endif + diff --git a/src/libsysprof/sysprof-helpers.c b/src/libsysprof/sysprof-helpers.c index 87d0061a..740806fe 100644 --- a/src/libsysprof/sysprof-helpers.c +++ b/src/libsysprof/sysprof-helpers.c @@ -26,6 +26,7 @@ #include #include "sysprof-helpers.h" +#include "sysprof-backport-autocleanups.h" #include "helpers.h" #include "ipc-service.h"