From 97961ed2cec379c0bbee3823503bb8fd5f67257b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 23 Mar 2017 16:49:58 -0400 Subject: [PATCH] build: Expose autocleanups unconditionally, start using them I'd like to do this in rpm-ostree at least. Originally I was looking at porting to `G_DECLARE_FINAL_TYPE` but eh, this is easier for now and won't bump our GLib dependency which might matter for our embedded users. For now I just did a few replacements in the `remote` command line. A full port can come as we do other code cleanups. This will actually break the flatpak build right now, but that's easy to fix. And we concluded in e.g. https://bugs.freedesktop.org/show_bug.cgi?id=95065#c5 it's a bug for downstream projects to do that. Closes: #756 Approved by: jlebon --- src/libostree/ostree-autocleanups.h | 6 +----- src/ostree/ot-remote-builtin-add-cookie.c | 2 +- src/ostree/ot-remote-builtin-add.c | 2 +- src/ostree/ot-remote-builtin-delete-cookie.c | 2 +- src/ostree/ot-remote-builtin-delete.c | 2 +- src/ostree/ot-remote-builtin-gpg-import.c | 2 +- src/ostree/ot-remote-builtin-list-cookies.c | 2 +- src/ostree/ot-remote-builtin-list.c | 2 +- src/ostree/ot-remote-builtin-refs.c | 2 +- src/ostree/ot-remote-builtin-show-url.c | 2 +- src/ostree/ot-remote-builtin-summary.c | 2 +- 11 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/libostree/ostree-autocleanups.h b/src/libostree/ostree-autocleanups.h index 7301ef1d..f030b50e 100644 --- a/src/libostree/ostree-autocleanups.h +++ b/src/libostree/ostree-autocleanups.h @@ -26,14 +26,10 @@ G_BEGIN_DECLS -#ifndef OSTREE_WITH_AUTOCLEANUPS -#define OSTREE_WITH_AUTOCLEANUPS 0 -#endif - /* 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)) +#if defined(OSTREE_COMPILATION) || GLIB_CHECK_VERSION(2, 44, 0) /* * The following types have no specific clear/free/unref functions, so diff --git a/src/ostree/ot-remote-builtin-add-cookie.c b/src/ostree/ot-remote-builtin-add-cookie.c index e4156172..d5ea3da5 100644 --- a/src/ostree/ot-remote-builtin-add-cookie.c +++ b/src/ostree/ot-remote-builtin-add-cookie.c @@ -37,7 +37,7 @@ gboolean ot_remote_builtin_add_cookie (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; const char *domain; const char *path; diff --git a/src/ostree/ot-remote-builtin-add.c b/src/ostree/ot-remote-builtin-add.c index 93c989f9..3e3aeda9 100644 --- a/src/ostree/ot-remote-builtin-add.c +++ b/src/ostree/ot-remote-builtin-add.c @@ -45,7 +45,7 @@ gboolean ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; const char *remote_url; char **iter; diff --git a/src/ostree/ot-remote-builtin-delete-cookie.c b/src/ostree/ot-remote-builtin-delete-cookie.c index 6d1b85ad..cb1177fc 100644 --- a/src/ostree/ot-remote-builtin-delete-cookie.c +++ b/src/ostree/ot-remote-builtin-delete-cookie.c @@ -37,7 +37,7 @@ gboolean ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; const char *domain; const char *path; diff --git a/src/ostree/ot-remote-builtin-delete.c b/src/ostree/ot-remote-builtin-delete.c index 8a4dd5f3..cac1b7ea 100644 --- a/src/ostree/ot-remote-builtin-delete.c +++ b/src/ostree/ot-remote-builtin-delete.c @@ -36,7 +36,7 @@ gboolean ot_remote_builtin_delete (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; gboolean ret = FALSE; diff --git a/src/ostree/ot-remote-builtin-gpg-import.c b/src/ostree/ot-remote-builtin-gpg-import.c index d1db06d0..4df0dfe7 100644 --- a/src/ostree/ot-remote-builtin-gpg-import.c +++ b/src/ostree/ot-remote-builtin-gpg-import.c @@ -94,7 +94,7 @@ gboolean ot_remote_builtin_gpg_import (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; g_autoptr(GInputStream) source_stream = NULL; const char *remote_name; const char * const *key_ids; diff --git a/src/ostree/ot-remote-builtin-list-cookies.c b/src/ostree/ot-remote-builtin-list-cookies.c index 1c3924af..83d75a57 100644 --- a/src/ostree/ot-remote-builtin-list-cookies.c +++ b/src/ostree/ot-remote-builtin-list-cookies.c @@ -36,7 +36,7 @@ gboolean ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; g_autofree char *jar_path = NULL; g_autofree char *cookie_file = NULL; diff --git a/src/ostree/ot-remote-builtin-list.c b/src/ostree/ot-remote-builtin-list.c index faf8d8ad..0769ece7 100644 --- a/src/ostree/ot-remote-builtin-list.c +++ b/src/ostree/ot-remote-builtin-list.c @@ -34,7 +34,7 @@ gboolean ot_remote_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; g_auto(GStrv) remotes = NULL; guint ii, n_remotes = 0; gboolean ret = FALSE; diff --git a/src/ostree/ot-remote-builtin-refs.c b/src/ostree/ot-remote-builtin-refs.c index 9e742912..f5b3afe3 100644 --- a/src/ostree/ot-remote-builtin-refs.c +++ b/src/ostree/ot-remote-builtin-refs.c @@ -36,7 +36,7 @@ gboolean ot_remote_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; gboolean ret = FALSE; g_autoptr(GHashTable) refs = NULL; diff --git a/src/ostree/ot-remote-builtin-show-url.c b/src/ostree/ot-remote-builtin-show-url.c index 401dfb0b..c1666558 100644 --- a/src/ostree/ot-remote-builtin-show-url.c +++ b/src/ostree/ot-remote-builtin-show-url.c @@ -33,7 +33,7 @@ gboolean ot_remote_builtin_show_url (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; g_autofree char *remote_url = NULL; gboolean ret = FALSE; diff --git a/src/ostree/ot-remote-builtin-summary.c b/src/ostree/ot-remote-builtin-summary.c index 39321b53..b4d99254 100644 --- a/src/ostree/ot-remote-builtin-summary.c +++ b/src/ostree/ot-remote-builtin-summary.c @@ -40,7 +40,7 @@ gboolean ot_remote_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error) { g_autoptr(GOptionContext) context = NULL; - glnx_unref_object OstreeRepo *repo = NULL; + g_autoptr(OstreeRepo) repo = NULL; const char *remote_name; g_autoptr(GBytes) summary_bytes = NULL; g_autoptr(GBytes) signature_bytes = NULL;