All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH 1/2] Introduce grub_malloc0()
Date: Thu, 16 Jul 2009 11:41:37 -0400	[thread overview]
Message-ID: <1247758897.4235.17.camel@mj> (raw)
In-Reply-To: <d7ead6de0907160822w2e653e16k2440f3ecb12b7a25@mail.gmail.com>

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



  reply	other threads:[~2009-07-16 15:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 23:40 [PATCH 1/2] Introduce grub_malloc0() Pavel Roskin
2009-07-15 23:40 ` [PATCH 2/2] Disable lzo compression, lzma is doing its job just fine Pavel Roskin
2009-07-16 16:24   ` Vladimir 'phcoder' Serbinenko
2009-07-18 18:18     ` Robert Millan
2009-07-19 17:45       ` Pavel Roskin
2009-07-19 18:24         ` Vladimir 'phcoder' Serbinenko
2009-07-19 20:33           ` Pavel Roskin
2009-07-16 15:22 ` [PATCH 1/2] Introduce grub_malloc0() Vladimir 'phcoder' Serbinenko
2009-07-16 15:41   ` Pavel Roskin [this message]
2009-07-16 15:53     ` Vladimir 'phcoder' Serbinenko
2009-07-17 15:02       ` Pavel Roskin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247758897.4235.17.camel@mj \
    --to=proski@gnu.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.