MGE General C Library - API Documentation  v1.8.4
Library of general C functions.
dllist.h
Go to the documentation of this file.
1 
16 #ifndef DLLIST_H
17 #define DLLIST_H
18 
20 
21 #include <stddef.h>
22 
24 
26 struct dllistnode {
27  void *object;
28  struct dllistnode *prevnode;
29  struct dllistnode *nextnode;
30 };
31 
32 struct dllistnode *add_dll_node(struct dllistnode *currentnode,
33  const void *object, size_t objsize);
34 
41 static inline struct dllistnode *
42 find_prev_dll_node(struct dllistnode *currentnode)
43 {
44  return currentnode->prevnode;
45 }
46 
53 static inline struct dllistnode *
54 find_next_dll_node(struct dllistnode *currentnode)
55 {
56  return currentnode->nextnode;
57 }
58 
59 struct dllistnode *free_dllist(struct dllistnode *currentnode);
60 
62 
63 #endif /* ndef DLLIST_H */
void * object
The object attached to the node.
Definition: dllist.h:27
static struct dllistnode * find_next_dll_node(struct dllistnode *currentnode)
Find and return the next node.
Definition: dllist.h:54
struct dllistnode * nextnode
The subsequent node.
Definition: dllist.h:29
static struct dllistnode * find_prev_dll_node(struct dllistnode *currentnode)
Find and return the previous node.
Definition: dllist.h:42
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.
Definition: dllist.c:43
Header file to ease portability.
#define END_C_DECLS
Use END_C_DECLS at the end of C declarations.
Definition: mge-portability.h:34
struct dllistnode * prevnode
The preceding node.
Definition: dllist.h:28
#define BEGIN_C_DECLS
BEGIN_C_DECLS should be used at the beginning of declarations so that C++ compilers don&#39;t mangle thei...
Definition: mge-portability.h:30
Doubly linked list node.
Definition: dllist.h:26
struct dllistnode * free_dllist(struct dllistnode *currentnode)
Free the entire list.
Definition: dllist.c:92