MGE General C Library - API Documentation  v1.3.5
Library of general C functions.
dllist.h
Go to the documentation of this file.
1 
16 /* **********************************************************************
17  * *
18  * Changelog *
19  * *
20  * Date Author Version Description *
21  * *
22  * 06/05/2016 MG 1.0.1 First release. *
23  * 16/07/2016 MG 1.0.2 Move towards kernel coding style. *
24  * 17/07/2016 MG 1.0.3 Remove function prototype comments. *
25  * 05/11/2017 MG 1.0.4 Add Doxygen comments. *
26  * 09/11/2017 MG 1.0.5 Add SPDX license tag. *
27  * 02/01/2018 MG 1.0.6 Move to new source directory structure. *
28  * 11/06/2019 MG 1.0.7 clang-format coding style changes. *
29  * Extract find_prev and find_next from .c *
30  * file and make static inline. *
31  * *
32  ************************************************************************
33  */
34 
35 #ifndef DLLIST_H
36 #define DLLIST_H
37 
38 #include <portability.h>
39 
41 
43 struct dllistnode {
44  void *object;
45  struct dllistnode *prevnode;
46  struct dllistnode *nextnode;
47 };
48 
49 struct dllistnode *add_dll_node(struct dllistnode *currentnode,
50  const void *object, size_t objsize);
51 
58 static inline struct dllistnode *
59 find_prev_dll_node(struct dllistnode *currentnode)
60 {
61  return currentnode->prevnode;
62 }
63 
70 static inline struct dllistnode *
71 find_next_dll_node(struct dllistnode *currentnode)
72 {
73  return currentnode->nextnode;
74 }
75 
76 struct dllistnode *free_dllist(struct dllistnode *currentnode);
77 
79 
80 #endif /* ndef DLLIST_H */
81 
void * object
The object attached to the node.
Definition: dllist.h:44
static struct dllistnode * find_next_dll_node(struct dllistnode *currentnode)
Find and return the next node.
Definition: dllist.h:71
struct dllistnode * nextnode
The subsequent node.
Definition: dllist.h:46
static struct dllistnode * find_prev_dll_node(struct dllistnode *currentnode)
Find and return the previous node.
Definition: dllist.h:59
Header file to ease portability.
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:72
struct dllistnode * prevnode
The preceding node.
Definition: dllist.h:45
#define END_C_DECLS
Use END_C_DECLS at the end of C declarations.
Definition: portability.h:50
#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: portability.h:46
Doubly linked list node.
Definition: dllist.h:43
struct dllistnode * free_dllist(struct dllistnode *currentnode)
Free the entire list.
Definition: dllist.c:121