goption: Move a variable declaration to the scopes where it’s used

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 <pwithnall@gnome.org>

Helps: #3527
This commit is contained in:
Philip Withnall 2024-11-07 13:48:07 +00:00
parent 664aca14a5
commit 4d49fc8222
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA

View File

@ -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;