On Thu, 2009-07-16 at 17:22 +0200, Vladimir 'phcoder' Serbinenko wrote:
> On Thu, Jul 16, 2009 at 1:40 AM, Pavel Roskin<pro...@gnu.org> 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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to