45
52
typedef struct ib_list_node_struct ib_list_node_t;
46
53
typedef struct ib_list_helper_struct ib_list_helper_t;
48
/********************************************************************
55
/****************************************************************//**
49
56
Create a new list using mem_alloc. Lists created with this function must be
50
freed with ib_list_free. */
57
freed with ib_list_free.
53
61
ib_list_create(void);
54
62
/*=================*/
58
/********************************************************************
65
/****************************************************************//**
64
ib_list_t* list); /* in: list */
71
ib_list_t* list); /*!< in: list */
66
/********************************************************************
67
Add the data to the end of the list. */
73
/****************************************************************//**
74
Add the data to the end of the list.
75
@return new list node */
72
/* out: new list node*/
73
ib_list_t* list, /* in: list */
74
void* data, /* in: data */
75
mem_heap_t* heap); /* in: memory heap to use */
80
ib_list_t* list, /*!< in: list */
81
void* data, /*!< in: data */
82
mem_heap_t* heap); /*!< in: memory heap to use */
77
/********************************************************************
78
Add the data after the indicated node. */
84
/****************************************************************//**
85
Add the data after the indicated node.
86
@return new list node */
83
/* out: new list node*/
84
ib_list_t* list, /* in: list */
85
ib_list_node_t* prev_node, /* in: node preceding new node (can
91
ib_list_t* list, /*!< in: list */
92
ib_list_node_t* prev_node, /*!< in: node preceding new node (can
87
void* data, /* in: data */
88
mem_heap_t* heap); /* in: memory heap to use */
94
void* data, /*!< in: data */
95
mem_heap_t* heap); /*!< in: memory heap to use */
90
/********************************************************************
97
/****************************************************************//**
91
98
Remove the node from the list. */
96
ib_list_t* list, /* in: list */
97
ib_list_node_t* node); /* in: node to remove */
103
ib_list_t* list, /*!< in: list */
104
ib_list_node_t* node); /*!< in: node to remove */
99
/********************************************************************
100
Get the first node in the list. */
106
/****************************************************************//**
107
Get the first node in the list.
108
@return first node, or NULL */
103
111
ib_list_get_first(
104
112
/*==============*/
105
/* out: first node, or NULL */
106
ib_list_t* list); /* in: list */
113
ib_list_t* list); /*!< in: list */
108
/********************************************************************
109
Get the last node in the list. */
115
/****************************************************************//**
116
Get the last node in the list.
117
@return last node, or NULL */
112
120
ib_list_get_last(
113
121
/*=============*/
114
/* out: last node, or NULL */
115
ib_list_t* list); /* in: list */
122
ib_list_t* list); /*!< in: list */
118
125
struct ib_list_struct {
119
ib_list_node_t* first; /* first node */
120
ib_list_node_t* last; /* last node */
121
ibool is_heap_list; /* TRUE if this list was
126
ib_list_node_t* first; /*!< first node */
127
ib_list_node_t* last; /*!< last node */
128
ibool is_heap_list; /*!< TRUE if this list was
122
129
allocated through a heap */
125
132
/* A list node. */
126
133
struct ib_list_node_struct {
127
ib_list_node_t* prev; /* previous node */
128
ib_list_node_t* next; /* next node */
129
void* data; /* user data */
134
ib_list_node_t* prev; /*!< previous node */
135
ib_list_node_t* next; /*!< next node */
136
void* data; /*!< user data */
132
139
/* Quite often, the only additional piece of data you need is the per-item
133
140
memory heap, so we have this generic struct available to use in those
135
142
struct ib_list_helper_struct {
136
mem_heap_t* heap; /* memory heap */
137
void* data; /* user data */
143
mem_heap_t* heap; /*!< memory heap */
144
void* data; /*!< user data */
140
147
#ifndef UNIV_NONINL