gmain: remove unnecessary initialization of source_timeout in g_main_context_prepare_unlocked()

Note that the variable source_timeout is already initialized upon
definition, at the beginning of the block.

It's easy to see, that no code changes the variable between the variable
definition, and the place where it was initialized. It was thus
unnecessary.

It's not about dropping the unnecessary code (the compiler could do that
just fine too). It's that there is the other branch of the "if/else", where
the variable is also not initialized. But the other branch also requires
that the variable is in fact initialized to -1, because prepare()
callbacks are free not to explicitly set the output value. So both
branches require the variable to be initialized to -1, but only one of
them did. This poses unnecessary questions about whether anything is
wrong. Avoid that by dropping the redundant code.
This commit is contained in:
Thomas Haller 2023-05-17 08:04:02 +02:00
parent a71b0c0461
commit 30b5418608

View File

@ -3855,10 +3855,7 @@ g_main_context_prepare_unlocked (GMainContext *context,
context->in_check_or_prepare--;
}
else
{
source_timeout = -1;
result = FALSE;
}
result = FALSE;
if (result == FALSE && source->priv->ready_time != -1)
{