Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033
00034
00035
00036
00037
00038 #ifndef _clist_h
00039 #define _clist_h
00040
00042 #define clist_init(c, next, prev) \
00043 do{ \
00044 (c)->next=(void*)(c); \
00045 (c)->prev=(void*)(c); \
00046 } while(0)
00047
00048
00049
00058 #define clist_insert_sublist(head, s, e, next, prev) \
00059 do{ \
00060 (s)->prev=(void*)(head); \
00061 (e)->next=(head)->next; \
00062 (e)->next->prev=(e); \
00063 (head)->next=s; \
00064 }while(0)
00065
00066
00067
00075 #define clist_append_sublist(head, s, e, next, prev) \
00076 do{ \
00077 (s)->prev=(head)->prev; \
00078 (e)->next=(void*)(head); \
00079 (s)->prev->next=(s); \
00080 (head)->prev=(e); \
00081 }while(0)
00082
00083
00084
00085
00092 #define clist_rm_sublist(s, e, next, prev) \
00093 do{\
00094 (s)->prev->next=(e)->next; \
00095 (e)->next->prev=(s)->prev ; \
00096 }while(0)
00097
00098
00099
00101 #define clist_insert(head, c, next, prev) \
00102 clist_insert_sublist(head, c, c, next, prev)
00103
00104
00105
00107 #define clist_append(head, c, next, prev) \
00108 clist_append_sublist(head, c, c, next, prev)
00109
00110
00111
00113 #define clist_rm(c, next, prev) \
00114 clist_rm_sublist(c, c, next, prev)
00115
00116
00117
00119 #define clist_foreach(head, v, dir) \
00120 for((v)=(head)->dir; (v)!=(void*)(head); (v)=(v)->dir)
00121
00124 #define clist_foreach_safe(head, v, bak, dir) \
00125 for((v)=(head)->dir, (bak)=(v)->dir; (v)!=(void*)(head); \
00126 (v)=(bak), (bak)=(v)->dir)
00127 #endif