From 90bcc44e10eef7e23583e41ad10a56cfe6fd31f3 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 6 Oct 2016 12:11:16 +0200 Subject: [PATCH] info: Minor cleanup --- app/flatpak-builtins-info.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/flatpak-builtins-info.c b/app/flatpak-builtins-info.c index 707107b26..cfcbc945a 100644 --- a/app/flatpak-builtins-info.c +++ b/app/flatpak-builtins-info.c @@ -53,6 +53,16 @@ static GOptionEntry options[] = { { NULL } }; +/* Print space unless this is the first item */ +static void +maybe_print_space (gboolean *first) +{ + if (*first) + *first = FALSE; + else + g_print (" "); +} + gboolean flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError **error) { @@ -141,30 +151,21 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError * if (opt_show_ref) { - if (first) - first = FALSE; - else - g_print (" "); + maybe_print_space (&first); g_print ("%s", ref); } if (opt_show_origin) { - if (first) - first = FALSE; - else - g_print (" "); + maybe_print_space (&first); g_print ("%s", origin ? origin : "-"); } if (opt_show_commit) { - if (first) - first = FALSE; - else - g_print (" "); + maybe_print_space (&first); g_print ("%s", commit); }