From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MB6BS-0004ql-0D for qemu-devel@nongnu.org; Mon, 01 Jun 2009 08:00:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MB6BN-0004n5-Cn for qemu-devel@nongnu.org; Mon, 01 Jun 2009 08:00:05 -0400 Received: from [199.232.76.173] (port=49055 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MB6BN-0004mw-82 for qemu-devel@nongnu.org; Mon, 01 Jun 2009 08:00:01 -0400 Received: from mail2.shareable.org ([80.68.89.115]:56685) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MB6BM-0001Gx-Cd for qemu-devel@nongnu.org; Mon, 01 Jun 2009 08:00:00 -0400 Date: Mon, 1 Jun 2009 12:59:57 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently Message-ID: <20090601115957.GD16957@shareable.org> References: <4A1F9FFE.3030100@redhat.com> <20380459.68691243589283394.JavaMail.root@srv-05.w4a.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20380459.68691243589283394.JavaMail.root@srv-05.w4a.fr> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jcd@tribudubois.net Cc: Kevin Wolf , qemu-devel@nongnu.org jcd@tribudubois.net wrote: > Hi Kevin, > > Thanks for pointing this. I guess it just sounds strange to me that > somebody would want to alloc 0 bytes. But why not ... Something that nobody pointed out is that sometimes you can have zero-length structures these days. E.g. if you have a struct containing a few spinlocks in the Linux kernel, it will be zero length when built on UP targets. I doubt if QEMU has any such structures, but it's the sort of thing that shouldn't break qemu_malloc(sizeof(some_type)). -- Jamie