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: Paul Brook
Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends
Date: Mon, 7 Dec 2009 16:24:00 +0000
User-agent: KMail/1.12.2 (Linux/2.6.31-1-amd64; KDE/4.3.2; x86_64; ; )

> type *qemu_new(type, n_types);
> type *qemu_new0(type, n_types);
> 
> type *qemu_renew(type, mem, n_types);
> type *qemu_renew0(type, mem, n_types);

It always annoys me having to specify element count for things that aren't 
arrays.

I suggestion a single object allocation function, and an array allocation 
function that allows zero length arrays. Possibly also a must-not-be-zero 
array form if we think it's important.

Note that conversion to object/type based allocation is not always 
straightforward because inheritance means we don't have the final object type 
when doing the allocation.

Paul




reply via email to

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