grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] Introduce grub_malloc0()


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH 1/2] Introduce grub_malloc0()
Date: Thu, 16 Jul 2009 17:53:20 +0200

On Thu, Jul 16, 2009 at 5:41 PM, Pavel Roskin<address@hidden> wrote:
> On Thu, 2009-07-16 at 17:22 +0200, Vladimir 'phcoder' Serbinenko wrote:
>> On Thu, Jul 16, 2009 at 1:40 AM, Pavel Roskin<address@hidden> 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().
After having read this I agree with you
>
> --
> Regards,
> Pavel Roskin
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git




reply via email to

[Prev in Thread] Current Thread [Next in Thread]