Skip to contentSkip to conversation

unnecessary parameter in grub_term_register_{input,output} ()

DISCUSSION Robert Millan 2 participants 2 messages Sep 19, 2009 – Sep 20, 2009

lore
Share & tools
lore
#0 lore raw

Maybe there's some subtle detail I'm missing, but it seems to me that it's completely pointless to pass the `name' parameter in all calls to these two functions:

static inline void
grub_term_register_input (const char *name __attribute__ ((unused)),
grub_term_input_t term)
{
grub_handler_register (&grub_term_input_class, GRUB_AS_HANDLER (term));
}

static inline void
grub_term_register_output (const char *name __attribute__ ((unused)),
grub_term_output_t term)
{
grub_handler_register (&grub_term_output_class, GRUB_AS_HANDLER (term));
}

Such as:

  void
  grub_console_init (void)
  {
    grub_term_register_output ("console", &grub_console_term_output);
    grub_term_register_input ("console", &grub_console_term_input);
  }

Since we don't use it, and the same information is in term->name anyway.

Does anyone see a reason not to simplify this?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#1 lore raw
Quoted 28 lines · Robert Millan

Maybe there's some subtle detail I'm missing, but it seems to me that it's completely pointless to pass the `name' parameter in all calls to these two functions:

 static inline void
 grub_term_register_input (const char *name __attribute__ ((unused)), grub_term_input_t term)
 {
  grub_handler_register (&grub_term_input_class, GRUB_AS_HANDLER (term)); }

 static inline void
 grub_term_register_output (const char *name __attribute__ ((unused)), grub_term_output_t term)
 {
  grub_handler_register (&grub_term_output_class, GRUB_AS_HANDLER (term)); }

Such as:

 void
 grub_console_init (void)
 {
   grub_term_register_output ("console", &grub_console_term_output); grub_term_register_input ("console", &grub_console_term_input); }

Quoted 3 lines

Since we don't use it, and the same information is in term->name anyway.

Does anyone see a reason not to simplify this?

Hi,

This is used to generate handler.lst automatically, and as name is marked as unused, it won't generate extra code.

Signature · 4 lines
Bean

gitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/