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

@ -28,6 +28,7 @@
struct grub_auth_user
{
struct grub_auth_user *next;
struct grub_auth_user **prev;
char *name;
grub_auth_callback_t callback;
void *arg;
@ -73,7 +74,7 @@ grub_auth_unregister_authentication (const char *user)
if (!cur->authenticated)
{
grub_free (cur->name);
grub_list_remove (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
grub_list_remove (GRUB_AS_LIST (cur));
grub_free (cur);
}
else
@ -121,7 +122,7 @@ grub_auth_deauthenticate (const char *user)
if (!cur->callback)
{
grub_free (cur->name);
grub_list_remove (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
grub_list_remove (GRUB_AS_LIST (cur));
grub_free (cur);
}
else