diff options
author | Philip Withnall <withnall@endlessm.com> | 2018-01-04 13:17:20 +0000 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-01-04 19:34:19 +0000 |
commit | b148160986cd6f829dd1dd186151dcada50c80fb (patch) | |
tree | 2baea399bd92bda0d6f5318bcf3b17b7351b549a | |
parent | c60b5d7e7c63a12fccb92b7f1fcafc81afde2930 (diff) | |
download | flatpak-b148160986cd6f829dd1dd186151dcada50c80fb.tar.gz |
common/dir: Use an actual function for autoptr support without P2P
When building with --disable-p2p, we create a stub type for
OstreeRepoFinderResult and OstreeRepoFinderResultv to avoid having to
add #ifdefs around all uses of them throughout the code base. We also
need to create autoptr functions for them so that the code can continue
to use g_autoptr(OstreeRepoFinderResult).
Previously, we were using `void` as the GDestroyNotify function for the
stub types. This wasn’t valid (it’s not a function), but it worked.
Since g_autolist() support has landed in GLib, this has broken. Fix it
by using a static inline no-op function as the GDestroyNotify function
instead. This should never be called, so exists purely to get things to
compile.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://github.com/flatpak/flatpak/issues/1279
Closes: #1293
Approved by: mwleeds
-rw-r--r-- | common/flatpak-dir.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/flatpak-dir.h b/common/flatpak-dir.h index a029f93d..fd6102bc 100644 --- a/common/flatpak-dir.h +++ b/common/flatpak-dir.h @@ -145,8 +145,10 @@ GQuark flatpak_dir_error_quark (void); typedef void OstreeRepoFinderResult; typedef void** OstreeRepoFinderResultv; -G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, void) -G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, void, NULL) +static inline void no_op (gpointer data) {} + +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, no_op) +G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, no_op, NULL) #endif /* !FLATPAK_ENABLE_P2P */ /** |