sphore 0.0.1
SPH openGL rendering engine
|
Code for generic list nodes, used by list.c. More...
Data Structures | |
struct | _node |
Internal storage for a list node. More... | |
Functions | |
node_t * | node_create (_SREnodeID id, void *data, node_t *next) |
Creates a new list node. | |
void | node_destroy (node_t *node) |
Destroys a node. | |
void | node_destroy_data (node_t *node, void(*destroy_func)(void *)) |
Destroys a node and the accosiated data. | |
node_t * | node_get_next (node_t *node) |
Gets the node that comes after the given node. | |
void | node_set_next (node_t *node, node_t *new_next) |
Changes the next node for the given node. | |
void * | node_get_data (node_t *node) |
Gets the data of the given node. | |
_SREnodeID | node_get_id (node_t *node) |
Gets the id of the given node. |
Code for generic list nodes, used by list.c.
node_t* node_create | ( | _SREnodeID | id, |
void * | data, | ||
node_t * | next | ||
) |
Creates a new list node.
The node should be cleaned up by node_destroy.
[in] | id | The id for the new node. |
[in] | data | The data for the new node. |
[in] | next | The node that comes after the new node. |
void node_destroy | ( | node_t * | node | ) |
Destroys a node.
This functino does not destroy the data accosiacted with the node, to do this you must use node_destroy_data.
[in] | node | The node to be destroyed. |
void node_destroy_data | ( | node_t * | node, |
void(*)(void *) | destroy_func | ||
) |
Destroys a node and the accosiated data.
Frees the given node aswell as the data ascociated with it using the destroy function.
void* node_get_data | ( | node_t * | node | ) |
Gets the data of the given node.
[in] | node | The node to query. |
_SREnodeID node_get_id | ( | node_t * | node | ) |
Gets the id of the given node.
[in] | node | The node to query. |
Gets the node that comes after the given node.
[in] | node | The node to query. |