cli/undeploy: Port to C99 style
authorColin Walters <walters@verbum.org>
Tue, 14 Jun 2022 13:50:07 +0000 (09:50 -0400)
committerColin Walters <walters@verbum.org>
Tue, 14 Jun 2022 13:51:41 +0000 (09:51 -0400)
General background cleanup.

src/ostree/ot-admin-builtin-undeploy.c

index 4115568989f38466915525d8cb5fcfd1246bed27..c079c83fe1b816bb509fc779f7cbf9fdace3b989 100644 (file)
@@ -34,15 +34,9 @@ static GOptionEntry options[] = {
 gboolean
 ot_admin_builtin_undeploy (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
 {
-  g_autoptr(GOptionContext) context = NULL;
-  g_autoptr(OstreeSysroot) sysroot = NULL;
-  const char *deploy_index_str;
-  int deploy_index;
-  g_autoptr(GPtrArray) current_deployments = NULL;
-  g_autoptr(OstreeDeployment) target_deployment = NULL;
-
-  context = g_option_context_new ("INDEX");
+  g_autoptr(GOptionContext) context = g_option_context_new ("INDEX");
 
+  g_autoptr(OstreeSysroot) sysroot = NULL;
   if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
                                           OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
                                           invocation, &sysroot, cancellable, error))
@@ -54,12 +48,13 @@ ot_admin_builtin_undeploy (int argc, char **argv, OstreeCommandInvocation *invoc
       return FALSE;
     }
 
-  current_deployments = ostree_sysroot_get_deployments (sysroot);
+  g_autoptr(GPtrArray) current_deployments = ostree_sysroot_get_deployments (sysroot);
 
-  deploy_index_str = argv[1];
-  deploy_index = atoi (deploy_index_str);
+  const char *deploy_index_str = argv[1];
+  int deploy_index = atoi (deploy_index_str);
 
-  target_deployment = ot_admin_get_indexed_deployment (sysroot, deploy_index, error);
+  g_autoptr(OstreeDeployment) target_deployment =
+    ot_admin_get_indexed_deployment (sysroot, deploy_index, error);
   if (!target_deployment)
     return FALSE;