|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently |
Date: | Tue, 02 Jun 2009 11:48:50 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Gerd Hoffmann wrote:
The idea to have allocators for arrays (and have them allow zero-length arrays) is fine. I wouldn't create two macros for new and renew array, you can just use usual realloc semantics (ptr == NULL -> alloc).Also I don't like the syntax that much as you'll have the IMHO non-intuitive code like this:QEMU_NEW_ARRAY(ptr, ...); instead of ptr = QEMU_NEW_ARRAY(...);then. I don't see another easy way to get the automagic sizeof(*ptr) stuff done though.
I too would like to QEMU_NEW() and QEMU_NEW_ARRAY() like you propose (or even better, new and new[]).
-- error compiling committee.c: too many arguments to function
[Prev in Thread] | Current Thread | [Next in Thread] |