squareball/sb-slist.h File Reference
Singly-linked list implementation.
More...
#include "sb-mem.h"
Go to the source code of this file.
Detailed Description
Singly-linked list implementation.
Function Documentation
Function that appends a node to the singly-linked list.
- Parameters:
-
| l | The singly-linked list. |
| data | The pointer to the data that will be stored in the new list node. |
- Returns:
- The singly-linked list itself.
- Examples:
- hello_slist.c.
Function that frees all the memory used by the singly-linked list.
- Parameters:
-
| l | The singly-linked list. |
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.
- Parameters:
-
| l | The singly-linked list. |
| free_func | Helper function, to free data stored in each node. |
- Examples:
- hello_slist.c.
Function that counts the number of nodes in the provided singly-linked list.
- Parameters:
-
| l | The singly-linked list. |
- Returns:
- The number of nodes in the singly-linked list.
- Examples:
- hello_slist.c.
Function that prepends a node to the singly-linked list.
- Parameters:
-
| l | The singly-linked list. |
| data | The pointer to the data that will be stored in the new list node. |
- Returns:
- The singly-linked list itself, a pointer to the new start node.
- Examples:
- hello_slist.c.