-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdllists.h
81 lines (55 loc) · 2.07 KB
/
dllists.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef dllist_h_SDR_2729234zxssnxcdqhkd_included
#define dllist_h_SDR_2729234zxssnxcdqhkd_included
//#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
struct dll_blockh_tag;
typedef struct dll_blockh_tag dll_blockh_t;
struct dll_listh_tag;
typedef struct dll_listh_tag dll_listh_t;
struct dll_list_iterator_tag;
typedef struct dll_list_iterator_tag dll_list_iterator_t;
#define DLL_LIST_MEM_FLAG_FREE_NONE 0
#define DLL_LIST_MEM_FLAG_FREE_HEAD 1
#define DLL_LIST_MEM_FLAG_FREE_USER_DATA 2
struct dll_listh_tag {
dll_blockh_t *dll_head,*dll_tail;
int dll_list_mem_flags;
char * dll_list_user_data;
};
#define DLL_BLOCK_MEM_FLAG_FREE_NONE 0
#define DLL_BLOCK_MEM_FLAG_FREE_HEAD 1
#define DLL_BLOCK_MEM_FLAG_FREE_USER_DATA 2
struct dll_blockh_tag {
dll_listh_t *dll_list;
dll_blockh_t *dll_prev,*dll_next;
int dll_block_mem_flags;
void * dll_block_user_data;
};
struct dll_list_iterator_tag {
int bwd;
int eol;
dll_listh_t *list;
dll_blockh_t *cur, *next;
};
dll_listh_t * dll_alloc_list (int listhead_size);
dll_listh_t * dll_alloc_list_ex (int user_data_size,void ** list_user_data);
dll_listh_t * dll_init_list (dll_listh_t * list, int flags);
void dll_deinit_list (dll_listh_t *list, int freeblocks);
dll_blockh_t * dll_alloc_block (int block_size,int initsize);
dll_blockh_t * dll_alloc_block_ex (int user_data_size, int initsize, void** block_user_data);
dll_blockh_t * dll_init_block (dll_blockh_t* block, int sz, int flags);
#define DLL_DEINIT_BLOCK_UNLINK 1
#define DLL_DEINIT_BLOCK_DONT_UNLINK 0
void dll_deinit_block (dll_blockh_t *bl, int unlink);
dll_blockh_t *dll_add_after (dll_listh_t *list, dll_blockh_t *block_after, dll_blockh_t *new_block);
dll_blockh_t *dll_add_before (dll_listh_t *list, dll_blockh_t *block_before, dll_blockh_t *new_block);
dll_blockh_t *dll_rm (dll_listh_t *list, dll_blockh_t *block);
void dll_iterate_fwd (dll_listh_t*list, dll_list_iterator_t*iterator);
void dll_iterate_bwd (dll_listh_t*list, dll_list_iterator_t*iterator);
dll_blockh_t * dll_next (dll_list_iterator_t*iterator);
#ifdef __cplusplus
}
#endif
#endif