build: Allow ostree to use g_autoptr on its types internally

As an example, I g_autoptred one OstreeRepo in the "ostree init"
command.

Closes: #295
Approved by: cgwalters
This commit is contained in:
Krzesimir Nowak 2016-05-13 08:08:49 +02:00 committed by Atomic Bot
parent 24e3ccb780
commit d5f6104335
3 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
-DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \
-DSHORTENED_SYSCONFDIR=\"$(shortened_sysconfdir)\" \ -DSHORTENED_SYSCONFDIR=\"$(shortened_sysconfdir)\" \
-DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' \ -DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' \
-DOSTREE_COMPILATION \
-DG_LOG_DOMAIN=\"OSTree\" \ -DG_LOG_DOMAIN=\"OSTree\" \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \
-DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48 -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48

View File

@ -30,7 +30,10 @@ G_BEGIN_DECLS
#define OSTREE_WITH_AUTOCLEANUPS 0 #define OSTREE_WITH_AUTOCLEANUPS 0
#endif #endif
#if OSTREE_WITH_AUTOCLEANUPS && GLIB_CHECK_VERSION(2, 44, 0) /* ostree can use g_autoptr backports from libglnx when glib is too
* old, but still avoid exposing them to users that also have an old
* glib */
#if defined(OSTREE_COMPILATION) || (OSTREE_WITH_AUTOCLEANUPS && GLIB_CHECK_VERSION(2, 44, 0))
/* /*
* The following types have no specific clear/free/unref functions, so * The following types have no specific clear/free/unref functions, so

View File

@ -37,7 +37,7 @@ gboolean
ostree_builtin_init (int argc, char **argv, GCancellable *cancellable, GError **error) ostree_builtin_init (int argc, char **argv, GCancellable *cancellable, GError **error)
{ {
GOptionContext *context = NULL; GOptionContext *context = NULL;
glnx_unref_object OstreeRepo *repo = NULL; g_autoptr(OstreeRepo) repo = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeRepoMode mode; OstreeRepoMode mode;