summaryrefslogtreecommitdiff
path: root/src/include/daa/list.h
blob: 27071d5f0e85941eb2c5c7e044a5c8b42726f024 (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
38
39
40

/*
 * Licensed Materials - Property of IBM
 *
 * trousers - An open source TCG Software Stack
 *
 * (C) Copyright International Business Machines Corp. 2004
 *
 */

#ifndef LIST_H_
#define LIST_H_

/* simple linked list template */
struct _list_t {
  void *obj;
  struct _list_t *next; // pointer to next node
};

typedef struct _list_t node_t; // each link is a list "node"

typedef struct {
	node_t *head; // pointer to first node
	node_t *current;
	node_t *previous;
} list_struct;

typedef list_struct* list_ptr;
typedef list_struct list_t[1];


list_ptr list_new();

void list_add(list_ptr list, void * obj);

void list_dump(list_ptr list);

void list_freeall(list_ptr list);

#endif /*LIST_H_*/