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: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends
Date: Mon, 07 Dec 2009 10:27:01 -0600
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

Paul Brook wrote:
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.

Sure.

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.

That's if you have the base object do the allocation, yup.

Paul





reply via email to

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