Re: Little code cleanup
On Saturday, 08 March 2008 at 14:17, Paul Walker wrote:
> On Sat, Mar 08, 2008 at 03:39:40AM +0100, Vincent Lefevre wrote:
>
> > You missed the point: gcc emits the warning even in the cases where such a
> > test is necessary.
>
> Agreed. However, in this case the test is *not necessary*. It serves no
> purpose. If someone later coming along changes the code so that mbox isn't
> an array, they should add appropriate tests for NULLity.
>
> And frankly, I think the changes of someone changing the code in that way
> are almost zero, so you're arguing to keep something which causes a warning
> right now, in case we get an incompetent programmer at some random point in
> the far future.
This was a surprisingly long thread :)
In my opinion, the NULL checks are pointless in these two cases, so
I'm applying the patch. As for the argument that the tests may
become useful in the future if the code is restructured, my hope is
that restructuring would involve making the functions smaller so that
it would be easier to tell what the type of the variable is by
the time it is used (that compose.c function is terrifying!).