From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGzAu-0002Es-HP for qemu-devel@nongnu.org; Sat, 05 Dec 2009 13:16:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGzAq-0002B2-0y for qemu-devel@nongnu.org; Sat, 05 Dec 2009 13:16:08 -0500 Received: from [199.232.76.173] (port=60255 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGzAp-0002Av-Tb for qemu-devel@nongnu.org; Sat, 05 Dec 2009 13:16:03 -0500 Received: from mail-pz0-f188.google.com ([209.85.222.188]:51775) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGzAq-0003c9-3U for qemu-devel@nongnu.org; Sat, 05 Dec 2009 13:16:04 -0500 Received: by pzk26 with SMTP id 26so3212708pzk.4 for ; Sat, 05 Dec 2009 10:16:02 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4B1A9BF4.2090909@redhat.com> References: <4B193DA5.6040507@codemonkey.ws> <4B1A9359.8080305@redhat.com> <4B1A9BF4.2090909@redhat.com> Date: Sat, 5 Dec 2009 19:16:02 +0100 Message-ID: <761ea48b0912051016vc1c7743wb061f0750f547b69@mail.gmail.com> Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Blue Swirl , Paul Brook , Markus Armbruster , qemu-devel@nongnu.org On Sat, Dec 5, 2009 at 6:44 PM, Avi Kivity wrote: [...] > >> I think Laurent's proposal would work. We even could go so far as >> rename the current function as qemu_malloc_possibly_broken (and adjust >> callers mechanically) and introduce two new versions, which handle the >> zero case in clearly advertised ways. Patches would fix the callers to >> use the correct one > > Good idea. =A0Let's name the function that returns a valid pointer > qemu_malloc() (since that's what many callers expect anyway, and it's ful= ly > backwards compatible), and see who calls > qemu_malloc_dont_call_me_with_zero(). Yes, you're always free to follow poor coding rules by breaking strict API. Laurent