diff --git a/src/rpmostree-builtin-rebase.c b/src/rpmostree-builtin-rebase.c index ff4b185f..c51370fd 100644 --- a/src/rpmostree-builtin-rebase.c +++ b/src/rpmostree-builtin-rebase.c @@ -61,8 +61,8 @@ rpmostree_builtin_rebase (int argc, gboolean changed; GSConsole *console = NULL; gboolean in_status_line = FALSE; - _cleanup_gkeyfile_ GKeyFile *old_origin = NULL; - _cleanup_gkeyfile_ GKeyFile *new_origin = NULL; + gs_unref_keyfile GKeyFile *old_origin = NULL; + gs_unref_keyfile GKeyFile *new_origin = NULL; if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, error)) goto out; diff --git a/src/rpmostree-cleanup.h b/src/rpmostree-cleanup.h index cbdd13a4..41bbe034 100644 --- a/src/rpmostree-cleanup.h +++ b/src/rpmostree-cleanup.h @@ -35,28 +35,11 @@ #include "libgsystem.h" -/* This one is in libgsystem git master, but not 2014.2 */ -GS_DEFINE_CLEANUP_FUNCTION0(GKeyFile*, _cleanup_g_key_file_unref, g_key_file_unref); -#define _cleanup_gkeyfile_ __attribute__((cleanup(_cleanup_g_key_file_unref))) - GS_DEFINE_CLEANUP_FUNCTION0(HySack, _cleanup_hy_sack_free, hy_sack_free); GS_DEFINE_CLEANUP_FUNCTION0(HyQuery, _cleanup_hy_query_free, hy_query_free); GS_DEFINE_CLEANUP_FUNCTION0(HyPackageList, _cleanup_hy_packagelist_free, hy_packagelist_free); GS_DEFINE_CLEANUP_FUNCTION0(HyStringArray, _cleanup_hy_stringarray_free, hy_stringarray_free); -static inline void -cleanup_closep (int *fdp) -{ - int fd; - - g_assert (fdp); - - fd = *fdp; - if (fd != -1) - (void) close (fd); -} - -#define _cleanup_close_ __attribute__((cleanup(cleanup_closep))) #define _cleanup_hysack_ __attribute__((cleanup(_cleanup_hy_sack_free))) #define _cleanup_hyquery_ __attribute__((cleanup(_cleanup_hy_query_free))) #define _cleanup_hypackagelist_ __attribute__((cleanup(_cleanup_hy_packagelist_free))) diff --git a/src/rpmostree-compose-builtin-tree.c b/src/rpmostree-compose-builtin-tree.c index 9f854052..46d1c397 100644 --- a/src/rpmostree-compose-builtin-tree.c +++ b/src/rpmostree-compose-builtin-tree.c @@ -132,14 +132,6 @@ yum_context_free (YumContext *yumctx) g_free (yumctx); } -static inline -void cleanup_keyfile_unref (void *loc) -{ - GKeyFile *locp = *((GKeyFile**)loc); - if (locp) - g_key_file_unref (locp); -} - static gboolean append_repo_and_cache_opts (RpmOstreeTreeComposeContext *self, JsonObject *treedata, @@ -202,7 +194,7 @@ append_repo_and_cache_opts (RpmOstreeTreeComposeContext *self, gs_free char *baseurl = g_strconcat ("file://", repodir, NULL); gs_free char *tmprepo_filename = g_strconcat (reponame, ".repo", NULL); gs_unref_object GFile *tmprepo_path = g_file_get_child (repos_tmpdir, tmprepo_filename); - __attribute__ ((cleanup(cleanup_keyfile_unref))) GKeyFile *keyfile = NULL; + gs_unref_keyfile GKeyFile *keyfile = NULL; gs_free char *data = NULL; gsize len; diff --git a/src/rpmostree-libcontainer.c b/src/rpmostree-libcontainer.c index 91569a16..1729f77f 100644 --- a/src/rpmostree-libcontainer.c +++ b/src/rpmostree-libcontainer.c @@ -136,8 +136,8 @@ _rpmostree_libcontainer_make_api_mounts (const char *dest) int _rpmostree_libcontainer_prep_dev (const char *dest_devdir) { - _cleanup_close_ int src_fd = -1; - _cleanup_close_ int dest_fd = -1; + gs_fd_close int src_fd = -1; + gs_fd_close int dest_fd = -1; struct stat stbuf; guint i; static const char *const devnodes[] = { "null", "zero", "full", "random", "urandom", "tty" }; diff --git a/src/rpmostree-postprocess.c b/src/rpmostree-postprocess.c index fdf596ea..5d52765d 100644 --- a/src/rpmostree-postprocess.c +++ b/src/rpmostree-postprocess.c @@ -1514,7 +1514,7 @@ rpmostree_commit (GFile *rootfs, gs_free char *new_revision = NULL; gs_unref_object GFile *root_tree = NULL; gs_unref_object OstreeSePolicy *sepolicy = NULL; - _cleanup_close_ int rootfs_fd = -1; + gs_fd_close int rootfs_fd = -1; /* hardcode targeted policy for now */ if (enable_selinux)