All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vesa Jääskeläinen" <chaac@nic.fi>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] allow user-configurable menucolor
Date: Tue, 01 Jan 2008 15:51:39 +0200	[thread overview]
Message-ID: <477A456B.2010209@nic.fi> (raw)
In-Reply-To: <20080101134026.GA32057@thorin>

Robert Millan wrote:
> On Tue, Jan 01, 2008 at 03:14:50PM +0200, Vesa Jääskeläinen wrote:
>> First some questions ;)
>>
>> - What happens when you forgot to provide / in this string ;) ?
> 
> grub_strchr() returns NULL and... whoops!  I'll fix that :-)
> 
>> - What happens when all memory is used?
> 
> What do you mean?

strdup() == NULL

>> - What happens when you alter list of colors... remove one entry of it
>> or add one.
> 
> This should never happen.  The list is just a human description of GRUB color
> codes.  GRUB VGA-style color codes are never changed in runtime, so neither
> should this list.

Yes, but... (below)

>> (eg. hard coding is bad... sizeof...)
> 
> Where can sizeof be used?

for (i = 0; i < 0x10; i++)
->
for (i = 0; i < sizeof(color_list) / sizeof(*color_list); i++)

or similar compile time calculation for it. If you are using construct
like this then your code always indexes array correctly. This of course
requires that color_list is local to source file being compiled. Point
being taken here is that never use hard-coded indexes to some arrays
when there is even slight possibility that it can change.

>> Now to your naming issue...
>>
>> This code is quite specific to be only local so I would propose following:
>>
>> parse_single_color_name -> parse_color_name
>>
>> parse_color_name -> parse_color_tuple, parse_color_pair,
>> parse_text_color or parse_menu_color
> 
> How about `parse_color_name_pair' ?

this name is good as any and goes well with parse_color_name name.




  reply	other threads:[~2008-01-01 13:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-01 12:47 [PATCH] allow user-configurable menucolor Robert Millan
2008-01-01 13:14 ` Vesa Jääskeläinen
2008-01-01 13:40   ` Robert Millan
2008-01-01 13:51     ` Vesa Jääskeläinen [this message]
2008-01-01 14:45       ` Robert Millan
2008-01-01 17:38         ` Robert Millan
2008-01-02 21:48           ` Robert Millan
2008-01-02 23:55             ` Yoshinori K. Okuji
2008-01-03  0:56               ` Robert Millan
2008-01-02 23:42 ` Yoshinori K. Okuji
2008-01-03  1:04   ` Robert Millan
2008-01-03 15:35     ` Robert Millan
2008-01-03 16:04       ` Vesa Jääskeläinen
2008-01-03 16:38         ` Robert Millan
2008-01-23  8:56           ` Marco Gerards
2008-01-04  8:02         ` opening new context (was: [PATCH] allow user-configurable menucolor) Robert Millan
2008-01-05  1:34           ` Yoshinori K. Okuji
2008-01-05 11:49             ` Robert Millan
2008-01-05 12:03               ` Yoshinori K. Okuji
2008-01-05 12:09                 ` Robert Millan
2008-01-05 21:45       ` [PATCH] allow user-configurable menucolor Jeroen Dekkers
2008-01-05 23:42         ` Robert Millan
2008-01-06 11:33           ` Jeroen Dekkers
2008-01-06 12:54             ` 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=477A456B.2010209@nic.fi \
    --to=chaac@nic.fi \
    --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.