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:
Vladimir 'phcoder' Serbinenko 2012-01-24 13:31:12 +01:00
parent 48b391e9ab
commit 87edb8940a
27 changed files with 111 additions and 75 deletions

View file

@ -46,6 +46,7 @@ struct grub_fs
{
/* The next filesystem. */
struct grub_fs *next;
struct grub_fs **prev;
/* My name. */
const char *name;
@ -111,7 +112,7 @@ grub_fs_register (grub_fs_t fs)
static inline void
grub_fs_unregister (grub_fs_t fs)
{
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
grub_list_remove (GRUB_AS_LIST (fs));
}
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))