Lines Matching refs:l

116 #define INSERT_NEW(element_type, l, element)\  argument
117 l->m_size++;\
118 if(l->m_head_free.m_pos != NULL)\
120 element = (element_type*)(l->m_head_free.m_pos);\
124 l->m_head_free.m_pos = element->m_next;\
128 l->m_head_free.m_pos = NULL;\
133 if(l->m_buf_size < l->m_size && l->m_head_free.m_pos == NULL)\
135 *(void**)l->m_buffer = cvAlloc(l->m_buf_size*sizeof(element_type) + sizeof(void*));\
136 l->m_buffer = *(void**)l->m_buffer;\
137 *(void**)l->m_buffer = NULL;\
138 element = (element_type*)((char*)l->m_buffer + sizeof(void*));\
142 element = (element_type*)((char*)l->m_buffer + sizeof(void*)) + l->m_size - 1;\
147 #define INSERT_FREE(element_type, l, element)\ argument
148 if(l->m_head_free.m_pos != NULL)\
150 ((element_type*)l->m_head_free.m_pos)->m_prev = element;\
152 element->m_next = ((element_type*)l->m_head_free.m_pos);\
153 l->m_head_free.m_pos = element;
172 void prefix##destroy_list_##type(_CVLIST* l)\
174 void* cur = l->m_first_buffer;\
182 cvFree(&l);\
184 CVPOS prefix##get_head_pos_##type(_CVLIST* l)\
186 return l->m_head;\
188 CVPOS prefix##get_tail_pos_##type(_CVLIST* l)\
190 return l->m_tail;\
222 void prefix##clear_list_##type(_CVLIST* l)\
224 l->m_head.m_pos = NULL;\
225 l->m_tail.m_pos = NULL;\
226 l->m_size = 0;\
227 l->m_head_free.m_pos = NULL;\
229 CVPOS prefix##add_head_##type(_CVLIST* l, type* data)\
232 INSERT_NEW(ELEMENT_##type, l, element);\
234 element->m_next = (ELEMENT_##type*)(l->m_head.m_pos);\
242 l->m_tail.m_pos = element;\
244 l->m_head.m_pos = element;\
245 return l->m_head;\
247 CVPOS prefix##add_tail_##type(_CVLIST* l, type* data)\
250 INSERT_NEW(ELEMENT_##type, l, element);\
252 element->m_prev = (ELEMENT_##type*)(l->m_tail.m_pos);\
260 l->m_head.m_pos = element;\
262 l->m_tail.m_pos = element;\
263 return l->m_tail;\
265 void prefix##remove_head_##type(_CVLIST* l)\
267 ELEMENT_##type* element = ((ELEMENT_##type*)(l->m_head.m_pos));\
272 l->m_head.m_pos = element->m_next;\
273 INSERT_FREE(ELEMENT_##type, l, element);\
274 l->m_size--;\
276 void prefix##remove_tail_##type(_CVLIST* l)\
278 ELEMENT_##type* element = ((ELEMENT_##type*)(l->m_tail.m_pos));\
283 l->m_tail.m_pos = element->m_prev;\
284 INSERT_FREE(ELEMENT_##type, l, element);\
285 l->m_size--;\
287 CVPOS prefix##insert_after_##type(_CVLIST* l, CVPOS pos, type* data)\
292 INSERT_NEW(ELEMENT_##type, l, element);\
301 l->m_tail.m_pos = element;\
305 CVPOS prefix##insert_before_##type(_CVLIST* l, CVPOS pos, type* data)\
310 INSERT_NEW(ELEMENT_##type, l, element);\
319 l->m_head.m_pos = element;\
323 void prefix##remove_at_##type(_CVLIST* l, CVPOS pos)\
332 l->m_head.m_pos = element->m_next;\
340 l->m_tail.m_pos = element->m_prev;\
342 INSERT_FREE(ELEMENT_##type, l, element);\
343 l->m_size--;\