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.
tingping/wmclass
Colin Walters 2017-03-22 14:35:10 -04:00 committed by Alexander Larsson
parent 04f8f3b564
commit 64fd2c2a8d
5 changed files with 8 additions and 23 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

@ -1 +1 @@
Subproject commit abd37a4790f86f53bfb442e6d80e1710f50bff92
Subproject commit 602fdd93cb7a339c6b5749eee73df926429a5ab8