Replace single-linked with double-linked lists. It results in more
compact and more efficient code. * grub-core/kern/list.c (grub_list_push): Moved from here ... * include/grub/list.h (grub_list_push): ... to here. Set prev. (grub_list_remove): Moved from here ... * include/grub/list.h (grub_list_remove): ... here. Use and set prev. (grub_prio_list_insert): Set prev. * include/grub/list.h (grub_list): Add prev. All users updated.
This commit is contained in:
parent
48b391e9ab
commit
87edb8940a
27 changed files with 111 additions and 75 deletions
|
@ -147,6 +147,7 @@ struct grub_term_input
|
|||
{
|
||||
/* The next terminal. */
|
||||
struct grub_term_input *next;
|
||||
struct grub_term_input **prev;
|
||||
|
||||
/* The terminal name. */
|
||||
const char *name;
|
||||
|
@ -171,6 +172,7 @@ struct grub_term_output
|
|||
{
|
||||
/* The next terminal. */
|
||||
struct grub_term_output *next;
|
||||
struct grub_term_output **prev;
|
||||
|
||||
/* The terminal name. */
|
||||
const char *name;
|
||||
|
@ -300,17 +302,15 @@ grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
|||
static inline void
|
||||
grub_term_unregister_input (grub_term_input_t term)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_unregister_output (grub_term_output_t term)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_outputs), GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue