From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBPi4-0007TQ-FM for qemu-devel@nongnu.org; Tue, 02 Jun 2009 04:51:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBPhz-0007SM-G1 for qemu-devel@nongnu.org; Tue, 02 Jun 2009 04:51:03 -0400 Received: from [199.232.76.173] (port=39760 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBPhz-0007S9-6P for qemu-devel@nongnu.org; Tue, 02 Jun 2009 04:50:59 -0400 Received: from mx2.redhat.com ([66.187.237.31]:37898) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MBPhy-0000qJ-O3 for qemu-devel@nongnu.org; Tue, 02 Jun 2009 04:50:58 -0400 Message-ID: <4A24E772.2080701@redhat.com> Date: Tue, 02 Jun 2009 11:48:50 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently References: <200905290758.11551.jcd@tribudubois.net> <4A1FD6E2.9020006@redhat.com> <200905291407.26757.paul@codesourcery.com> <200905291917.10535.jseward@acm.org> <60cad3f0905291412m670c7a6cw45f9b51f3122ddfb@mail.gmail.com> <4A24D40E.2060704@redhat.com> In-Reply-To: <4A24D40E.2060704@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Kevin Wolf , David Turner , Jean-Christophe Dubois , Paul Brook , qemu-devel@nongnu.org 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