summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-find-remotes.c
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2018-01-12 16:32:09 -0800
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-16 14:15:10 +0000
commitebc104d3c7671b2a84b83b14407359478b4150a4 (patch)
tree8d31e2d77eb27f4ff065ebb52b3ae10bab460c49 /src/ostree/ot-builtin-find-remotes.c
parent4c2205276ce49c9d895d7714d19eeba4932d7d51 (diff)
downloadostree-ebc104d3c7671b2a84b83b14407359478b4150a4.tar.gz
find-remotes: Minor fixes to --finders code
This introduces no functional changes, only cleanups. Closes: #1414 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-builtin-find-remotes.c')
-rw-r--r--src/ostree/ot-builtin-find-remotes.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ostree/ot-builtin-find-remotes.c b/src/ostree/ot-builtin-find-remotes.c
index 3df84a4f..67dbdaa6 100644
--- a/src/ostree/ot-builtin-find-remotes.c
+++ b/src/ostree/ot-builtin-find-remotes.c
@@ -37,8 +37,8 @@ static gboolean opt_pull = FALSE;
static GOptionEntry options[] =
{
{ "cache-dir", 0, 0, G_OPTION_ARG_FILENAME, &opt_cache_dir, "Use custom cache dir", NULL },
- { "finders", 0, 0, G_OPTION_ARG_STRING, &opt_finders, "Use the specified comma separated list of finders (e.g. config,lan,mount)", "FINDERS" },
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
+ { "finders", 0, 0, G_OPTION_ARG_STRING, &opt_finders, "Use the specified comma separated list of finders (e.g. config,lan,mount)", "FINDERS" },
{ "pull", 0, 0, G_OPTION_ARG_NONE, &opt_pull, "Pull the updates after finding them", NULL },
{ NULL }
};
@@ -119,7 +119,7 @@ collection_ref_free0 (OstreeCollectionRef *ref)
}
static gboolean
-validate_finders_list (char **finders,
+validate_finders_list (const char **finders,
GOptionContext *context,
GError **error)
{
@@ -139,10 +139,10 @@ validate_finders_list (char **finders,
return FALSE;
}
- for (char **iter = finders; iter && *iter; iter++)
+ for (const char **iter = finders; iter && *iter; iter++)
{
gboolean is_valid_finder = FALSE;
- for (int i = 0; i < 3; i++)
+ for (unsigned int i = 0; i < G_N_ELEMENTS (valid_finders); i++)
{
if (valid_finders[i].already_used == TRUE)
continue;
@@ -234,11 +234,11 @@ ostree_builtin_find_remotes (int argc,
g_auto(GStrv) finders_strings = NULL;
finders_strings = g_strsplit (opt_finders, ",", 0);
- if (!validate_finders_list (finders_strings, context, error))
+ if (!validate_finders_list ((const char **)finders_strings, context, error))
return FALSE;
- finders = g_ptr_array_new ();
- for (char **iter =finders_strings; iter && *iter; iter++)
+ finders = g_ptr_array_new_with_free_func (NULL);
+ for (const char **iter = (const char **)finders_strings; iter && *iter; iter++)
{
if (g_strcmp0 (*iter, "config") == 0)
{