From 4d49fc82220eaef5a5a452ebfef3bd3ba6123590 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 7 Nov 2024 13:48:07 +0000 Subject: [PATCH] =?UTF-8?q?goption:=20Move=20a=20variable=20declaration=20?= =?UTF-8?q?to=20the=20scopes=20where=20it=E2=80=99s=20used?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces no functional changes, it just splits the declaration of `j` into three smaller-scoped declarations of the same type. This will make the following commit clearer. Signed-off-by: Philip Withnall Helps: #3527 --- glib/goption.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glib/goption.c b/glib/goption.c index c59f14855..f9bae854f 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -1801,7 +1801,7 @@ g_option_context_parse (GOptionContext *context, gchar ***argv, GError **error) { - gint i, j, k; + gint i, k; GList *list; g_return_val_if_fail (context != NULL, FALSE); @@ -1956,7 +1956,7 @@ g_option_context_parse (GOptionContext *context, arg = (*argv)[i] + 1; arg_length = strlen (arg); nulled_out = g_newa0 (gboolean, arg_length); - for (j = 0; j < arg_length; j++) + for (int j = 0; j < arg_length; j++) { if (context->help_enabled && (arg[j] == '?' || (arg[j] == 'h' && !has_h_entry))) @@ -1995,7 +1995,7 @@ g_option_context_parse (GOptionContext *context, { gchar *new_arg = NULL; gint arg_index = 0; - for (j = 0; j < arg_length; j++) + for (int j = 0; j < arg_length; j++) { if (!nulled_out[j]) { @@ -2084,7 +2084,7 @@ g_option_context_parse (GOptionContext *context, if (k > i) { k -= i; - for (j = i + k; j < *argc; j++) + for (int j = i + k; j < *argc; j++) { (*argv)[j-k] = (*argv)[j]; (*argv)[j] = NULL;