summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-config.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2022-06-14 09:50:07 -0400
committerColin Walters <walters@verbum.org>2022-06-14 10:03:58 -0400
commitf8403f46dc19da16f23f93c990a644244801efa0 (patch)
treeef14f9326619ad1738a8f74924a6141fced2898d /src/ostree/ot-builtin-config.c
parente65c8e72c82a62b2068ed902edcc06ac71fbbaf8 (diff)
downloadostree-f8403f46dc19da16f23f93c990a644244801efa0.tar.gz
cli/config: Port to C99 style
General background cleanup.
Diffstat (limited to 'src/ostree/ot-builtin-config.c')
-rw-r--r--src/ostree/ot-builtin-config.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/ostree/ot-builtin-config.c b/src/ostree/ot-builtin-config.c
index 3c160492..5c1334a5 100644
--- a/src/ostree/ot-builtin-config.c
+++ b/src/ostree/ot-builtin-config.c
@@ -61,18 +61,10 @@ split_key_string (const char *k,
gboolean
ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = NULL;
- g_autoptr(OstreeRepo) repo = NULL;
- const char *op;
- const char *section_key;
- const char *value;
- g_autofree char *section = NULL;
- g_autofree char *key = NULL;
- g_autoptr(GKeyFile) config = NULL;
- int correct_argc;
- context = g_option_context_new ("(get KEY|set KEY VALUE|unset KEY)");
+ g_autoptr(GOptionContext) context = g_option_context_new ("(get KEY|set KEY VALUE|unset KEY)");
+ g_autoptr(OstreeRepo) repo = NULL;
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
return FALSE;
@@ -82,12 +74,11 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
return FALSE;
}
- op = argv[1];
+ const char *op = argv[1];
+ int correct_argc = 3;
if (!strcmp (op, "set"))
correct_argc = 4;
- else
- correct_argc = 3;
if (argc > correct_argc)
{
@@ -95,6 +86,11 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
return FALSE;
}
+ g_autofree char *section = NULL;
+ g_autofree char *key = NULL;
+ g_autoptr(GKeyFile) config = NULL;
+ const char *section_key;
+ const char *value;
if (!strcmp (op, "set"))
{
if (opt_group)