squareball
0.2.0.43-8b14
A general-purpose library for C99
|
Singly-linked list implementation. More...
#include "sb-mem.h"
Go to the source code of this file.
Data Structures | |
struct | sb_slist_t |
Functions | |
sb_slist_t * | sb_slist_append (sb_slist_t *l, void *data) |
sb_slist_t * | sb_slist_prepend (sb_slist_t *l, void *data) |
void | sb_slist_free (sb_slist_t *l) |
void | sb_slist_free_full (sb_slist_t *l, sb_free_func_t free_func) |
size_t | sb_slist_length (sb_slist_t *l) |
Singly-linked list implementation.
sb_slist_t* sb_slist_append | ( | sb_slist_t * | l, |
void * | data | ||
) |
Function that appends a node to the singly-linked list.
l | The singly-linked list. |
data | The pointer to the data that will be stored in the new list node. |
void sb_slist_free | ( | sb_slist_t * | l | ) |
Function that frees all the memory used by the singly-linked list.
l | The singly-linked list. |
void sb_slist_free_full | ( | sb_slist_t * | l, |
sb_free_func_t | free_func | ||
) |
Function that frees all the memory used by the singly-linked list, and the data stored in the list nodes, using the provided helper function.
l | The singly-linked list. |
free_func | Helper function, to free data stored in each node. |
size_t sb_slist_length | ( | sb_slist_t * | l | ) |
Function that counts the number of nodes in the provided singly-linked list.
l | The singly-linked list. |
sb_slist_t* sb_slist_prepend | ( | sb_slist_t * | l, |
void * | data | ||
) |
Function that prepends a node to the singly-linked list.
l | The singly-linked list. |
data | The pointer to the data that will be stored in the new list node. |