qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends


From: Ian Molton
Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends
Date: Sat, 05 Dec 2009 23:08:19 +0000
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)

Avi Kivity wrote:

> Only if you allocate using POSIX malloc().  If you allocate using a
> function that is defined to return a valid pointer for zero length
> allocations, you're happy.

Wouldnt it be better to, rather than use a qemu_malloc() that is utterly
counterintuitive in that it has no way to report failure, and behaves in
ways people dont expect, to use normal malloc() and never pass it 0 ?

Seriously, who does that anyway? why call malloc when you dont want the
space? so you can use realloc? 99.99% of the time realloc() is the Wrong
Solution(tm).

stick to what people know, and LART them for misuse of it if necessary.

(Just my 2p)

-Ian




reply via email to

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