bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: striconv typo


From: Simon Josefsson
Subject: Re: striconv typo
Date: Tue, 12 Jan 2010 22:03:25 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Simon Josefsson wrote:
>> I happened to run 'syntax-check' on some gnulib files, and notices this
>> in lib/striconv.c:
>> 
>>       if (result != NULL)
>>         free (result);
>> 
>> Bruno, do you object to removing the unnecessary if?
>
> It is in a part of the code which is rarely executed, therefore the penalty
> of an added function call does not matter. Therefore, no objection.

Fixed, thanks.

> Btw, it's not a typo. When I write
>
>       if (result != NULL)
>         free (result);
>
> it's either
>   - because it makes the logic clearer (you have to think less when you want
>     to verify that the code is correct), or
>   - an attempt to not assume too much from a system function, or
>   - an optimization that avoids an unnecessary function call.

Understood, it was wrong to use the word 'typo' to characterize this.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]