qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free


From: Gonglei
Subject: Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free
Date: Sat, 11 Oct 2014 11:47:52 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2014/10/11 11:44, Eric Blake wrote:

> On 10/10/2014 09:32 PM, Gonglei wrote:
> 
>>>> Actually, I had noted that C standard says it is a no-operation.
>>>> But that doesn't mean that every C-library handles it like that.
>>>
>>> EVERY libc that is C89 compliant handles it like that.  The last
>>> platform that failed on free(NULL) was SunOS 4, which is such
>>> museum-ware it's not funny.  There is no need to cater to platforms from
>>> 25 years ago.
> 
>>
>> But why some callers make a check,
>> but some other callers don't do this check?
> 
> Because some people haven't learned that free(NULL) is safe yet.  You're
> welcome to simplify code as you touch it.
> 

OK, I will. Thanks again :)

>> Can I consider those check is superfluous?
> 
> Yes.  Checking for NULL before calling free() or g_free() is wasted effort.
> 


Best regards,
-Gonglei




reply via email to

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