aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot-sam460ex/board/ACube/menu/list.c
blob: eb9997c8dc328f19e2d06c7b27d235a88baf6204 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//#include "menu.h"
#include "list.h"
void list_init(mylist_t *l)
{
    l->first = NULL;
    l->last  = NULL;
}

bool list_empty(mylist_t *l)
{
    if (l->first == NULL) 	return true;
    else 					return false;
}

void list_add(mylist_t *l, node_t *n)
{
    if (l->first == NULL)
    {
		l->first = n;
		l->last = n;
		n->prev = NULL;
		n->next = NULL;
    }
    else
    {
		node_t *b = l->last;
		l->last = n;

		n->prev = b;
		n->next = 0;

		b->next = n;
    }
}