[Geany-devel] either uninitialized variable or a redundant condition

Colomban Wendling lists.ban at xxxxx
Sat Aug 6 17:37:27 UTC 2011

Le 06/08/2011 16:03, Daniel Marjamäki a écrit :
> Hi!


> [src/tools.c:127]: (information) Suspecting that uninitialized
> variable is used: stock_id
> Either there is an "uninitialized variable" issue or else there is a
> redundant condition.
> In the file src/tools.c.
> The condition that might be redundant is on line 111:
>        else if (g_shell_parse_argv(cmd, &argc, &argv, &err))
> If the condition is always true, then the "else if" could be converted
> to a "else" and the function call could be moved into the "else" body.
> If the condition can be false then stock_id will be uninitialized when
> it's used on line 127.

No, because it is initialized in all possible branches, whatever returns
g_shell_parse_argv() (because it either return TRUE or sets err to
non-null). However it's true that the code is not really beautiful, I'll
refactor it a bit.


More information about the Devel mailing list