All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] read command
Date: Fri, 1 Feb 2008 23:48:00 +0100	[thread overview]
Message-ID: <20080201224800.GA12043@thorin> (raw)
In-Reply-To: <20080201224550.GA11984@thorin>

On Fri, Feb 01, 2008 at 11:45:50PM +0100, Robert Millan wrote:
> +static void *
> +grub_xrealloc (void *ptr, grub_size_t size)
> +{
> +  void *value = grub_realloc (ptr, size);
> +  if (value == 0)
> +    grub_fatal ("Virtual memory exhausted");
> +  return value;
> +}
> +
> +static char *
> +grub_getline (void)
> +{
> +  int i;
> +  char *line;
> +
> +  i = 0;
> +  line = grub_malloc (1 + i + sizeof('\0'));
> +
> +  while ((line[i - 1] != '\n') && (line[i - 1] != '\r'))
> +    {
> +      line[i] = grub_getkey ();
> +      if (grub_isprint (line[i]))
> +	grub_putchar (line[i]);
> +      i++;
> +      line = grub_xrealloc (line, 1 + i + sizeof('\0'));
> +    }
> +  line[i] = '\0';
> +
> +  return line;
> +}

Does it make sense to move any of these two to kernel?  Or to normal.mod ?  Or
maybe just to un-static-ize them and leave them here?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



  reply	other threads:[~2008-02-01 22:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01 22:45 [PATCH] read command Robert Millan
2008-02-01 22:48 ` Robert Millan [this message]
2008-02-02 12:38   ` Yoshinori K. Okuji
2008-02-02 17:05     ` Robert Millan
2008-02-02 18:48       ` Yoshinori K. Okuji
2008-02-02 20:34         ` Robert Millan

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=20080201224800.GA12043@thorin \
    --to=rmh@aybabtu.com \
    --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.