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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends
Date: Mon, 07 Dec 2009 10:45:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Ian Molton <address@hidden> writes:

> Markus Armbruster wrote:
>
>>     p = malloc(n * sizeof(struct foo);
>>     if (n && !p)
>>         exit_no_mem();
>>     for (i = 0; i < n; i++)
>>         compute_one(p, i);
>> 
>> With qemu_malloc(), the error handling moves into qemu_malloc():
>> 
>>     p = qemu_malloc(n * sizeof(struct foo);
>>     for (i = 0; i < n; i++)
>>         compute_one(p, i);
>
> And you lose the ability to fail gracefully...

That's a deliberate choice.  It has its drawbacks, it has its
advantages.  And it's not related to the question at hand: permitting
zero arguments.




reply via email to

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