ubinos
dlist.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 Sung Ho Park
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef UBICLIB_DLIST_H_
8 #define UBICLIB_DLIST_H_
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
23 #include <ubinos_config.h>
24 #include <ubinos/type.h>
25 
27 #define DLIST_ERR__NOTEXIST -21
28 
30 typedef struct _dlist_elmt_t
31 {
32  struct _dlist_elmt_t * prev;
33  struct _dlist_elmt_t * next;
34  void * list;
35  void * data;
36  void * data2;
38 
47 
60 
72 
74 typedef struct _dlist_t
75 {
76  unsigned int count;
80  void * data;
82 
90 typedef dlist_t * dlist_pt;
91 
97 #define dlist_init(dlist) \
98 { \
99  (dlist)->count = 0; \
100  (dlist)->head = NULL; \
101  (dlist)->tail = NULL; \
102  (dlist)->cur = NULL; \
103  (dlist)->data = NULL; \
104 }
105 
116 int dlist_create(dlist_pt * dlist_p);
117 
129 int dlist_delete(dlist_pt * dlist_p);
130 
147 
164 
176 
188 
204 int dlist_find(dlist_pt dlist, dlist_elmt_pt * elmt_p, void * data);
205 
221 int dlist_findandremove(dlist_pt dlist, dlist_elmt_pt * elmt_p, void * data);
222 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif /* UBICLIB_DLIST_H_ */
int dlist_find(dlist_pt dlist, dlist_elmt_pt *elmt_p, void *data)
int dlist_findandremove(dlist_pt dlist, dlist_elmt_pt *elmt_p, void *data)
int dlist_create(dlist_pt *dlist_p)
dlist_t * dlist_pt
Definition: dlist.h:90
dlist_elmt_t * dlist_elmt_pt
Definition: dlist.h:46
int dlist_insertprev(dlist_pt dlist, dlist_elmt_pt ref, dlist_elmt_pt elmt)
int dlist_elmt_delete(dlist_elmt_pt elmt)
int dlist_delete(dlist_pt *dlist_p)
struct _dlist_elmt_t dlist_elmt_t
struct _dlist_t dlist_t
int dlist_remove(dlist_elmt_pt elmt)
dlist_elmt_pt dlist_getcurnext(dlist_pt dlist)
int dlist_insertnext(dlist_pt dlist, dlist_elmt_pt ref, dlist_elmt_pt elmt)
dlist_elmt_pt dlist_elmt_create(void *data, void *data2)
Definition: dlist.h:31
void * data2
Definition: dlist.h:36
void * data
Definition: dlist.h:35
struct _dlist_elmt_t * next
Definition: dlist.h:33
void * list
Definition: dlist.h:34
struct _dlist_elmt_t * prev
Definition: dlist.h:32
Definition: dlist.h:75
void * data
Definition: dlist.h:80
dlist_elmt_pt cur
Definition: dlist.h:79
dlist_elmt_pt tail
Definition: dlist.h:78
dlist_elmt_pt head
Definition: dlist.h:77
unsigned int count
Definition: dlist.h:76
ubinos basic data type