Remove grub_list_pop
This commit is contained in:
parent
8cfa78770d
commit
0959e5ec30
5 changed files with 11 additions and 24 deletions
|
@ -309,14 +309,10 @@ grub_gettext_init_ext (const char *lang)
|
|||
static void
|
||||
grub_gettext_delete_list (void)
|
||||
{
|
||||
struct grub_gettext_msg *item;
|
||||
|
||||
while ((item =
|
||||
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
|
||||
while (grub_gettext_msg_list)
|
||||
{
|
||||
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
||||
grub_free (original);
|
||||
|
||||
grub_free ((char *) grub_gettext_msg_list->name);
|
||||
grub_gettext_msg_list = grub_gettext_msg_list->next;
|
||||
/* Don't delete the translated message because could be in use. */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ struct grub_list
|
|||
typedef struct grub_list *grub_list_t;
|
||||
|
||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||
void * EXPORT_FUNC(grub_list_pop) (grub_list_t *head);
|
||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||
|
||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||
|
|
12
kern/list.c
12
kern/list.c
|
@ -28,18 +28,6 @@ grub_list_push (grub_list_t *head, grub_list_t item)
|
|||
*head = item;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_list_pop (grub_list_t *head)
|
||||
{
|
||||
grub_list_t item;
|
||||
|
||||
item = *head;
|
||||
if (item)
|
||||
*head = item->next;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void
|
||||
grub_list_remove (grub_list_t *head, grub_list_t item)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ struct grub_handler_list
|
|||
grub_command_t cmd;
|
||||
};
|
||||
|
||||
static grub_list_t handler_list;
|
||||
static struct grub_handler_list *handler_list;
|
||||
|
||||
static grub_err_t
|
||||
grub_handler_cmd (struct grub_command *cmd,
|
||||
|
@ -127,7 +127,7 @@ insert_handler (char *name, char *module)
|
|||
}
|
||||
|
||||
item->cmd->data = data;
|
||||
grub_list_push (&handler_list, GRUB_AS_LIST (item));
|
||||
grub_list_push (GRUB_AS_LIST_P (&handler_list), GRUB_AS_LIST (item));
|
||||
}
|
||||
|
||||
/* Read the file handler.lst for auto-loading. */
|
||||
|
@ -211,8 +211,10 @@ free_handler_list (void)
|
|||
{
|
||||
struct grub_handler_list *item;
|
||||
|
||||
while ((item = grub_list_pop (&handler_list)) != 0)
|
||||
while (handler_list)
|
||||
{
|
||||
item = handler_list;
|
||||
handler_list = handler_list->next;
|
||||
grub_free (item->cmd->data);
|
||||
grub_unregister_command (item->cmd);
|
||||
grub_free (item->name);
|
||||
|
|
|
@ -66,8 +66,10 @@ free_failures (void)
|
|||
{
|
||||
grub_test_failure_t item;
|
||||
|
||||
while ((item = grub_list_pop (GRUB_AS_LIST_P (&failure_list))) != 0)
|
||||
while (failure_list)
|
||||
{
|
||||
item = failure_list;
|
||||
failure_list = item->next;
|
||||
if (item->message)
|
||||
grub_free (item->message);
|
||||
|
||||
|
|
Loading…
Reference in a new issue