Go to the source code of this file.
Macros |
#define | list_push(L, E) (L)->push(L, E) |
#define | list_pop(L) (L)->pop(L) |
#define | list_empty(L) (L)->empty(L) |
#define | list_get(L, N) (L)->get((list_t *)L, N) |
#define | list_replace(L, N, E) (L)->replace((list_t *)L, N, E) |
#define | list_add(L, N) (L)->push(L, N) |
#define | list_size(L) (L)->size(L) |
#define | list_iterator_reset(L) (L)->iterator_reset(L) |
#define | list_iterator_next(L) (L)->iterator_next(L) |
#define | list_destroy(L) (*(L))->destroy(L) |
#define | list_shift(L) (L)->shift(L) |
#define | LIST_COMMON |
Detailed Description
Macro Definition Documentation
#define list_add |
( |
|
L, |
|
|
|
N |
|
) |
| (L)->push(L, N) |
Value:int (*push)(
list_t *,
void *); \
int (*empty)(
const list_t *); \
void *(*get)(
const list_t *,
size_t index); \
int (*replace)(
list_t *,
size_t index,
void *); \
size_t (*size)(
const list_t *); \
void (*iterator_reset)(
list_t *); \
void *(*iterator_next)(
list_t *); \
#define list_destroy |
( |
|
L | ) |
(*(L))->destroy(L) |
#define list_empty |
( |
|
L | ) |
(L)->empty(L) |
#define list_get |
( |
|
L, |
|
|
|
N |
|
) |
| (L)->get((list_t *)L, N) |
#define list_iterator_next |
( |
|
L | ) |
(L)->iterator_next(L) |
#define list_iterator_reset |
( |
|
L | ) |
(L)->iterator_reset(L) |
#define list_pop |
( |
|
L | ) |
(L)->pop(L) |
#define list_push |
( |
|
L, |
|
|
|
E |
|
) |
| (L)->push(L, E) |
#define list_replace |
( |
|
L, |
|
|
|
N, |
|
|
|
E |
|
) |
| (L)->replace((list_t *)L, N, E) |
#define list_shift |
( |
|
L | ) |
(L)->shift(L) |
#define list_size |
( |
|
L | ) |
(L)->size(L) |
Typedef Documentation
Function Documentation
list_t* list_array_create |
( |
size_t |
size | ) |
|
Create new array-based list.
- Parameters
-
- Returns
- newly allocated list (list_t)
Free the memory occupied by this list. This function assumes the data elements were freed beforehand.
- Parameters
-
Advance to the next list value.
- Parameters
-
- Returns
- the next list value, or NULL if there aren't more elements left to iterate over or if the element itself is NULL
Reset the list iterator.
- Parameters
-
list_t* list_linked_create |
( |
void |
| ) |
|
Create a new linked list.
- Returns
- a pointer to the newly created list (list_t), or NULL on memory allocation failure
Destroy list. This function will not destroy any of the data stored in it. You'll have to do that manually beforehand.
- Parameters
-
int table_addn |
( |
table_t * |
table, |
|
|
bstr * |
key, |
|
|
void * |
element |
|
) |
| |
Add a new table element. This function currently makes a copy of the key, which is inefficient.
- Parameters
-
void table_clear |
( |
table_t * |
table | ) |
|
Remove all elements from the table.
- Parameters
-
table_t* table_create |
( |
size_t |
size | ) |
|
Create a new table structure.
- Parameters
-
- Returns
- newly created table_t
void table_destroy |
( |
table_t ** |
_table | ) |
|
Destroy a table.
- Parameters
-
void* table_get |
( |
const table_t * |
table, |
|
|
const bstr * |
key |
|
) |
| |
Retrieve the first element in the table with the given key.
- Parameters
-
- Returns
- table element, or NULL if not found
void* table_get_c |
( |
const table_t * |
table, |
|
|
const char * |
cstr |
|
) |
| |
- Parameters
-
table | |
key | Retrieve the first element in the table with the given key (as a NUL-terminated string). |
table | |
cstr | |
- Returns
- table element, or NULL if not found
bstr* table_iterator_next |
( |
table_t * |
t, |
|
|
void ** |
data |
|
) |
| |
Advance to the next table element.
- Parameters
-
- Returns
- pointer to the key and the element if there is a next element, NULL otherwise
void table_iterator_reset |
( |
table_t * |
table | ) |
|
Reset the table iterator.
- Parameters
-
size_t table_size |
( |
const table_t * |
table | ) |
|
Returns the size of the table.
- Parameters
-
- Returns
- table size