MGE General C Library - Full Internal Documentation  v1.6.8
Library of general C functions.
dllist.h File Reference

Doubly linked list header file. More...

#include <portability.h>
Include dependency graph for dllist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dllistnode
 Doubly linked list node. More...
 

Functions

struct dllistnodeadd_dll_node (struct dllistnode *currentnode, const void *object, size_t objsize)
 Add a node to the tail of the doubly linked list. More...
 
static struct dllistnodefind_prev_dll_node (struct dllistnode *currentnode)
 Find and return the previous node. More...
 
static struct dllistnodefind_next_dll_node (struct dllistnode *currentnode)
 Find and return the next node. More...
 
struct dllistnodefree_dllist (struct dllistnode *currentnode)
 Free the entire list. More...
 

Detailed Description

Doubly linked list header file.

Header file for doubly linked lists in the libmgec shared library.

Author
Copyright (C) 2016-2019, 2021 Mark Grant

Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only

Version
v1.0.8 ==== 03/12/2021

Function Documentation

◆ add_dll_node()

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.

Parameters
currentnodeA pointer to the first node or NULL if list not yet started.
objectObject to be attached to the node.
objsizeSize of object.
Returns
A pointer to the first node. Returns NULL on error.

◆ find_next_dll_node()

static struct dllistnode* find_next_dll_node ( struct dllistnode currentnode)
inlinestatic

Find and return the next node.

Parameters
currentnodeThe current node.
Returns
A pointer to the next node in the list or NULL if no subsequent node exists.

◆ find_prev_dll_node()

static struct dllistnode* find_prev_dll_node ( struct dllistnode currentnode)
inlinestatic

Find and return the previous node.

Parameters
currentnodeThe current node.
Returns
A pointer to the previous node in the list or NULL if no previous node exists.

◆ free_dllist()

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.

Parameters
currentnodeThe root node.
Returns
NULL