MGE General C Library - Full Internal Documentation v1.8.4
Library of general C functions.
|
Builds, traverses and releases a doubly linked list. More...
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libmgec/dllist.h>
#include <libmgec/mge-errno.h>
Functions | |
static void | free_dll_node (struct dllistnode *currentnode) |
Free memory allocated to the node. More... | |
struct dllistnode * | add_dll_node (struct dllistnode *currentnode, const void *object, size_t objsize) |
Add a node to the tail of the doubly linked list. More... | |
struct dllistnode * | free_dllist (struct dllistnode *currentnode) |
Free the entire list. More... | |
Variables | |
static struct dllistnode * | priornode = NULL |
Holds the address of the preceding node when adding nodes. More... | |
Builds, traverses and releases a doubly linked list.
Build, manipulate and bi-directional traverse functionality for doubly linked lists.
Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only
struct dllistnode * add_dll_node | ( | struct dllistnode * | currentnode, |
const void * | object, | ||
size_t | objsize | ||
) |
Add a node to the tail of the doubly linked list.
On error mge_errno will be set.
currentnode | A pointer to the first node or NULL if list not yet started. |
object | Object to be attached to the node. |
objsize | Size of object. |
|
static |
Free memory allocated to the node.
(Both node and object).
currentnode | The node to free. |
struct dllistnode * free_dllist | ( | struct dllistnode * | currentnode | ) |
Free the entire list.
Remove all nodes and free memory allocated to the dllist. Walks the list deleting nodes.
currentnode | The root node. |
|
static |
Holds the address of the preceding node when adding nodes.