|
| From: | Avi Kivity |
| Subject: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends |
| Date: | Sat, 05 Dec 2009 19:07:37 +0200 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091203 Fedora/3.0-3.13.rc2.fc12 Thunderbird/3.0 |
On 12/04/2009 06:49 PM, Anthony Liguori wrote:
I still believe that it is poor practice to pass size==0 to *malloc(). I think actively discouraging this in qemu is a good thing because it's a broken idiom.
Why? Unless we have a separate array allocator (like C++'s new and new[]), we need to support zero-element arrays without pushing the burden to callers (in the same way that for () supports zero iteration loops without a separate if ()).
-- Do not meddle in the internals of kernels, for they are subtle and quick to panic.
| [Prev in Thread] | Current Thread | [Next in Thread] |