From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MRT5g-0007Ur-5I for mharc-grub-devel@gnu.org; Thu, 16 Jul 2009 11:41:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRT5e-0007Sw-Hy for grub-devel@gnu.org; Thu, 16 Jul 2009 11:41:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRT5Z-0007OU-O4 for grub-devel@gnu.org; Thu, 16 Jul 2009 11:41:46 -0400 Received: from [199.232.76.173] (port=49064 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRT5Z-0007OQ-FI for grub-devel@gnu.org; Thu, 16 Jul 2009 11:41:41 -0400 Received: from c60.cesmail.net ([216.154.195.49]:31557) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MRT5Y-00074F-Vu for grub-devel@gnu.org; Thu, 16 Jul 2009 11:41:41 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 16 Jul 2009 11:41:39 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id F27F534C6D for ; Thu, 16 Jul 2009 11:41:37 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: References: <20090715234038.31016.40532.stgit@mj.roinet.com> Content-Type: text/plain Date: Thu, 16 Jul 2009 11:41:37 -0400 Message-Id: <1247758897.4235.17.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH 1/2] Introduce grub_malloc0() X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2009 15:41:47 -0000 On Thu, 2009-07-16 at 17:22 +0200, Vladimir 'phcoder' Serbinenko wrote: > On Thu, Jul 16, 2009 at 1:40 AM, Pavel Roskin wrote: > > Even though it's a new function added to the core, its use makes > > core.img smaller. And it makes modules smaller too. > I like the idea even if function name is inexplicit. Do you have a > better alterative? I was thinking about it. Here are some ideas: grub_malloc0 - good that "0" is there, bad that malloc0 is not a traditional libc name. It's easy to scan sources for both grub_malloc and grub_malloc0 grub_calloc - we would need two arguments (element size and element number) to be compatible with libc. We could make it a macro expandable to grub_malloc0 to optimize out multiplication. Still, having two arguments introduces unnecessary choice to the caller. grub_calloc with one argument - this break the tradition or replacing libc functions with equivalents. grub_zalloc - similar to Linux kzalloc and kmalloc. By zalloc is not a libc function. grub_malloc_cleared, grub_malloc_zero - too long and just as nonstandard as grub_zalloc. grub_0malloc - even more weird than grub_malloc0, and it's harder to scan for both. After having written that, I actually tend to prefer grub_zalloc(). -- Regards, Pavel Roskin