From 64fd2c2a8d91969dbac7041124afefbd63905fbe Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 22 Mar 2017 14:35:10 -0400 Subject: [PATCH] Bump libglnx, use new glnx_throw(), fix callers One benefit here becomes immediately obvious - `flatpak_fail()` was lacking `G_GNUC_PRINTF` which meant we missed a lot of type checking. Fix up the callers. --- app/flatpak-builtins-build-bundle.c | 2 +- builder/builder-utils.c | 2 +- common/flatpak-utils.c | 17 ----------------- common/flatpak-utils.h | 8 +++++--- libglnx | 2 +- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/app/flatpak-builtins-build-bundle.c b/app/flatpak-builtins-build-bundle.c index c1c54cae..12eb93d7 100644 --- a/app/flatpak-builtins-build-bundle.c +++ b/app/flatpak-builtins-build-bundle.c @@ -467,7 +467,7 @@ flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, return flatpak_fail (error, _("'%s' is not a valid name: %s"), name, my_error->message); if (!flatpak_is_valid_branch (branch, &my_error)) - return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, &my_error); + return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, my_error->message); if (opt_runtime) full_branch = flatpak_build_runtime_ref (name, branch, opt_arch); diff --git a/builder/builder-utils.c b/builder/builder-utils.c index 0703f9fd..c99b8537 100644 --- a/builder/builder-utils.c +++ b/builder/builder-utils.c @@ -989,7 +989,7 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error) } else { - return flatpak_fail (0, 0, "%s: Wrong ELF data encoding", data->filename); + return flatpak_fail (error, "%s: Wrong ELF data encoding", data->filename); } debug_sections = data->debug_sections; diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 086136d1..c5f006bb 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -285,23 +285,6 @@ flatpak_path_match_prefix (const char *pattern, return NULL; /* Should not be reached */ } -gboolean -flatpak_fail (GError **error, const char *format, ...) -{ - g_autofree char *message = NULL; - va_list args; - - va_start (args, format); - message = g_strdup_vprintf (format, args); - va_end (args); - - g_set_error_literal (error, - G_IO_ERROR, G_IO_ERROR_FAILED, - message); - - return FALSE; -} - const char * flatpak_get_kernel_arch (void) { diff --git a/common/flatpak-utils.h b/common/flatpak-utils.h index a01355dc..96e42204 100644 --- a/common/flatpak-utils.h +++ b/common/flatpak-utils.h @@ -46,9 +46,11 @@ typedef enum { #define FLATPAK_VARIANT_DICT_INITIALIZER {{{0,}}} #endif -gboolean flatpak_fail (GError **error, - const char *format, - ...); +/* https://github.com/GNOME/libglnx/pull/38 + * Note by using #define rather than wrapping via a static inline, we + * don't have to re-define attributes like G_GNUC_PRINTF. + */ +#define flatpak_fail glnx_throw gint flatpak_strcmp0_ptr (gconstpointer a, gconstpointer b); diff --git a/libglnx b/libglnx index abd37a47..602fdd93 160000 --- a/libglnx +++ b/libglnx @@ -1 +1 @@ -Subproject commit abd37a4790f86f53bfb442e6d80e1710f50bff92 +Subproject commit 602fdd93cb7a339c6b5749eee73df926429a5ab8