cmd/show-remote-url: Port to C99 style
authorColin Walters <walters@verbum.org>
Thu, 24 Aug 2023 01:22:49 +0000 (21:22 -0400)
committerColin Walters <walters@verbum.org>
Thu, 24 Aug 2023 01:22:49 +0000 (21:22 -0400)
Just keeping up momentum.

src/ostree/ot-remote-builtin-show-url.c

index f83165360beeffb9bca231e87601aad49fe32b4f..0ce7ee35d7f44c4bb8104715a92b3318e6034951 100644 (file)
@@ -35,32 +35,24 @@ gboolean
 ot_remote_builtin_show_url (int argc, char **argv, OstreeCommandInvocation *invocation,
                             GCancellable *cancellable, GError **error)
 {
-  g_autoptr (GOptionContext) context = NULL;
+  g_autoptr (GOptionContext) context = g_option_context_new ("NAME");
   g_autoptr (OstreeRepo) repo = NULL;
-  const char *remote_name;
-  g_autofree char *remote_url = NULL;
-  gboolean ret = FALSE;
-
-  context = g_option_context_new ("NAME");
-
   if (!ostree_option_context_parse (context, option_entries, &argc, &argv, invocation, &repo,
                                     cancellable, error))
-    goto out;
+    return FALSE;
 
   if (argc < 2)
     {
       ot_util_usage_error (context, "NAME must be specified", error);
-      goto out;
+      return FALSE;
     }
 
-  remote_name = argv[1];
+  const char *remote_name = argv[1];
 
-  if (ostree_repo_remote_get_url (repo, remote_name, &remote_url, error))
-    {
-      g_print ("%s\n", remote_url);
-      ret = TRUE;
-    }
+  g_autofree char *remote_url = NULL;
+  if (!ostree_repo_remote_get_url (repo, remote_name, &remote_url, error))
+    return FALSE;
 
-out:
-  return ret;
+  g_print ("%s\n", remote_url);
+  return TRUE;
 }