Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / kern / list.c
bloba256bb3f87556bea3dfd8529af00a31f33be7626
1 /* list.c - grub list function */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #include <grub/list.h>
21 #include <grub/misc.h>
22 #include <grub/mm.h>
24 void *
25 grub_named_list_find (grub_named_list_t head, const char *name)
27 grub_named_list_t item;
29 FOR_LIST_ELEMENTS (item, head)
30 if (grub_strcmp (item->name, name) == 0)
31 return item;
33 return NULL;
36 void
37 grub_list_push (grub_list_t *head, grub_list_t item)
39 item->prev = head;
40 if (*head)
41 (*head)->prev = &item->next;
42 item->next = *head;
43 *head = item;
46 void
47 grub_list_remove (grub_list_t item)
49 if (item->prev)
50 *item->prev = item->next;
51 if (item->next)
52 item->next->prev = item->prev;
53 item->next = 0;
54 item->prev = 0;