List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:May 2 2011 10:55am
Subject:Re: bzr push into mysql-trunk branch (rafal.somla:3345 to 3346) Bug#11766631
Bug#11879051
View as plain text  
On 5/2/11 7:24 AM, Rafal Somla wrote:
> Hi again,
>
> On 29/04/2011 21:56, Davi Arnaut wrote:
>> On 4/29/11 4:45 PM, Rafal Somla wrote:
>>> + if (m_buf)
>>> + free(m_buf);
>>
>> free() handles NULL pointers just fine.
>
> Correct, but above code has 2 slight advantages:
>
> 1. It might be more efficient than calling free() in case m_buf is NULL.

It really doesn't make much of a difference. A good compiler is better 
at making these kind of decisions -- on what is more efficient.

> 2. It will always work, even if on some exotic platform/configuration,
> free() does not handle NULL pointers.

This exotic platform/configuration won't be ANSI C. But, let's suppose 
this exists: yes, your code will work, but will be the only piece 
"working", because every other free in the server is going to crash upon 
seeing a NULL pointer.



Thread
bzr push into mysql-trunk branch (rafal.somla:3345 to 3346) Bug#11766631Bug#11879051Rafal Somla29 Apr
  • Re: bzr push into mysql-trunk branch (rafal.somla:3345 to 3346) Bug#11766631Bug#11879051Davi Arnaut29 Apr
    • Re: bzr push into mysql-trunk branch (rafal.somla:3345 to 3346) Bug#11766631Bug#11879051Rafal Somla2 May
      • Re: bzr push into mysql-trunk branch (rafal.somla:3345 to 3346) Bug#11766631Bug#11879051Davi Arnaut2 May