From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] User definable terminfo support
Date: Mon, 02 Jan 2006 20:44:53 +0100 [thread overview]
Message-ID: <878xtyjtxm.fsf@xs4all.nl> (raw)
In-Reply-To: <43B1DD7E.5090905@omniflux.com> (omniflux+lists@omniflux.com's message of "Tue, 27 Dec 2005 17:34:06 -0700")
Omniflux <omniflux+lists@omniflux.com> writes:
Hi,
Here is the review of the code that I promised. Please see my other
email about generic comments.
> +/* Delete terminfo definition from list. */
> +static void
> +delete_definition (terminfo_t *ti)
> {
> - return term.name;
> + terminfo_t *p, *q;
Please just declare one declaration at a time. Better would be:
terminfo_t *p;
terminfo_t *q;
> +/* Unescape a string. */
> +static char *
> +unescape_string (const char *in)
> +{
> + char *q, *new_string;
Same here.
> + new_string = (char *) grub_malloc (grub_strlen (in) + 1); /* New string will be <= current string. */
This line is way too long. Please make sure lines are 78 characters
or smaller. The best thing to do here is putting the comment above
this line. Same for the comments below.
Most error strings below are also too long:
> + if (i > 1)
> + return grub_error (GRUB_ERR_INVALID_COMMAND, "add, modify, delete and view are exclusive operations.");
You can put the string on a new line. If the string is still too long
you can make two strings out of it, like:
grub_error (FOO,
"bar"
"baz");
> + ti->name = grub_strdup (args[0]);
Typo.
> +static void
> +setup_defaults (void)
> +{
> + terminfo_t *ti;
> +
> + ti = (terminfo_t *) grub_malloc (sizeof (terminfo_t));
> + /* Do I need to test if malloc succeeded here? What do I do if it did not? */
Good one :-)
In that case default could be set to NULL, if that is allowed?
> + /* Default terminal definition vt100. */
> + ti->name = grub_strdup ("vt100");
> + ti->gotoxy = grub_strdup ("\e[%i%p1%d;%p2%dH");
> + ti->cls = grub_strdup ("\e[H\e[J");
> + ti->reverse_video_on = grub_strdup ("\e[7m");
> + ti->reverse_video_off = grub_strdup ("\e[m");
> + ti->cursor_on = grub_strdup ("\e[?25l");
> + ti->cursor_off = grub_strdup ("\e[?25h");
> + ti->next = 0;
Thanks,
Marco
next prev parent reply other threads:[~2006-01-02 19:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-28 0:34 [PATCH] User definable terminfo support Omniflux
2005-12-31 17:02 ` Marco Gerards
2006-01-02 19:53 ` Omniflux
2006-01-02 20:37 ` Marco Gerards
2006-01-02 21:33 ` Omniflux
2006-01-02 21:43 ` Marco Gerards
2006-01-02 19:44 ` Marco Gerards [this message]
2006-01-02 20:21 ` Omniflux
2006-01-02 20:43 ` Marco Gerards
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=878xtyjtxm.fsf@xs4all.nl \
--to=mgerards@xs4all.nl \
--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.