diff --git a/src/rpmostree-builtin-rpm.c b/src/rpmostree-builtin-rpm.c index ead250ca..45dc0c97 100644 --- a/src/rpmostree-builtin-rpm.c +++ b/src/rpmostree-builtin-rpm.c @@ -51,13 +51,6 @@ static GOptionEntry option_entries[] = { { NULL } }; -/* FIXME: merge and put into libgsystem or rpmostree-utils */ -#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ - static inline void func##p(type *p) { \ - if (*p) \ - func(*p); \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ static void header_free_p (gpointer data) @@ -521,7 +514,7 @@ rpmrev_free (struct RpmRevisionData *ptr) g_free (ptr); } -DEFINE_TRIVIAL_CLEANUP_FUNC(struct RpmRevisionData *, rpmrev_free); +_RPMOSTREE_DEFINE_TRIVIAL_CLEANUP_FUNC(struct RpmRevisionData *, rpmrev_free); #define _cleanup_rpmrev_ __attribute__((cleanup(rpmrev_freep))) diff --git a/src/rpmostree-treepkgdiff.c b/src/rpmostree-treepkgdiff.c index 98e5db76..20399bc1 100644 --- a/src/rpmostree-treepkgdiff.c +++ b/src/rpmostree-treepkgdiff.c @@ -23,6 +23,7 @@ #include "string.h" #include "rpmostree-treepkgdiff.h" +#include "rpmostree-util.h" #include #include @@ -36,17 +37,9 @@ #include "libgsystem.h" -/* Todo: move this to libgsystem */ -#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ - static inline void func##p(type *p) { \ - if (*p) \ - func(*p); \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ - -DEFINE_TRIVIAL_CLEANUP_FUNC(HySack, hy_sack_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(HyQuery, hy_query_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(HyPackageList, hy_packagelist_free); +_RPMOSTREE_DEFINE_TRIVIAL_CLEANUP_FUNC(HySack, hy_sack_free); +_RPMOSTREE_DEFINE_TRIVIAL_CLEANUP_FUNC(HyQuery, hy_query_free); +_RPMOSTREE_DEFINE_TRIVIAL_CLEANUP_FUNC(HyPackageList, hy_packagelist_free); #define _cleanup_hysack_ __attribute__((cleanup(hy_sack_freep))) #define _cleanup_hyquery_ __attribute__((cleanup(hy_query_freep))) diff --git a/src/rpmostree-util.h b/src/rpmostree-util.h index 6643b249..1c6ec308 100644 --- a/src/rpmostree-util.h +++ b/src/rpmostree-util.h @@ -22,6 +22,14 @@ #include +#define _RPMOSTREE_DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ + static inline void func##p(type *p) { \ + if (*p) \ + func(*p); \ + } \ + struct __useless_struct_to_allow_trailing_semicolon__ + + gboolean _rpmostree_util_enumerate_directory_allow_noent (GFile *dirpath, const char *queryargs,