Lines Matching refs:llist

84 	spl_ptr_llist         *llist;  member
132 spl_ptr_llist *llist = emalloc(sizeof(spl_ptr_llist)); in spl_ptr_llist_init() local
134 llist->head = NULL; in spl_ptr_llist_init()
135 llist->tail = NULL; in spl_ptr_llist_init()
136 llist->count = 0; in spl_ptr_llist_init()
137 llist->dtor = dtor; in spl_ptr_llist_init()
138 llist->ctor = ctor; in spl_ptr_llist_init()
140 return llist; in spl_ptr_llist_init()
144 static zend_long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_count() argument
146 return (zend_long)llist->count; in spl_ptr_llist_count()
150 static void spl_ptr_llist_destroy(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_destroy() argument
152 spl_ptr_llist_element *current = llist->head, *next; in spl_ptr_llist_destroy()
153 spl_ptr_llist_dtor_func dtor = llist->dtor; in spl_ptr_llist_destroy()
164 efree(llist); in spl_ptr_llist_destroy()
168 static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, zend_long offset, int back… in spl_ptr_llist_offset() argument
175 current = llist->tail; in spl_ptr_llist_offset()
177 current = llist->head; in spl_ptr_llist_offset()
193 static void spl_ptr_llist_unshift(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_unshift() argument
199 elem->next = llist->head; in spl_ptr_llist_unshift()
202 if (llist->head) { in spl_ptr_llist_unshift()
203 llist->head->prev = elem; in spl_ptr_llist_unshift()
205 llist->tail = elem; in spl_ptr_llist_unshift()
208 llist->head = elem; in spl_ptr_llist_unshift()
209 llist->count++; in spl_ptr_llist_unshift()
211 if (llist->ctor) { in spl_ptr_llist_unshift()
212 llist->ctor(elem); in spl_ptr_llist_unshift()
217 static void spl_ptr_llist_push(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_push() argument
222 elem->prev = llist->tail; in spl_ptr_llist_push()
226 if (llist->tail) { in spl_ptr_llist_push()
227 llist->tail->next = elem; in spl_ptr_llist_push()
229 llist->head = elem; in spl_ptr_llist_push()
232 llist->tail = elem; in spl_ptr_llist_push()
233 llist->count++; in spl_ptr_llist_push()
235 if (llist->ctor) { in spl_ptr_llist_push()
236 llist->ctor(elem); in spl_ptr_llist_push()
241 static void spl_ptr_llist_pop(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_pop() argument
243 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_pop()
253 llist->head = NULL; in spl_ptr_llist_pop()
256 llist->tail = tail->prev; in spl_ptr_llist_pop()
257 llist->count--; in spl_ptr_llist_pop()
261 if (llist->dtor) { in spl_ptr_llist_pop()
262 llist->dtor(tail); in spl_ptr_llist_pop()
271 static zval *spl_ptr_llist_last(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_last() argument
273 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_last()
283 static zval *spl_ptr_llist_first(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_first() argument
285 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_first()
295 static void spl_ptr_llist_shift(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_shift() argument
297 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_shift()
307 llist->tail = NULL; in spl_ptr_llist_shift()
310 llist->head = head->next; in spl_ptr_llist_shift()
311 llist->count--; in spl_ptr_llist_shift()
315 if (llist->dtor) { in spl_ptr_llist_shift()
316 llist->dtor(head); in spl_ptr_llist_shift()
354 while (intern->llist->count > 0) { in spl_dllist_object_free_storage()
355 spl_ptr_llist_pop(intern->llist, &tmp); in spl_dllist_object_free_storage()
363 spl_ptr_llist_destroy(intern->llist); in spl_dllist_object_free_storage()
389 intern->llist = (spl_ptr_llist *)spl_ptr_llist_init(other->llist->ctor, other->llist->dtor); in spl_dllist_object_new_ex()
390 spl_ptr_llist_copy(other->llist, intern->llist); in spl_dllist_object_new_ex()
391 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
394 intern->llist = other->llist; in spl_dllist_object_new_ex()
395 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
401 …intern->llist = (spl_ptr_llist *)spl_ptr_llist_init(spl_ptr_llist_zval_ctor, spl_ptr_llist_zval_dt… in spl_dllist_object_new_ex()
402 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
490 *count = spl_ptr_llist_count(intern->llist); in spl_dllist_object_count_elements()
498 spl_ptr_llist_element *current = intern->llist->head, *next; in spl_dllist_object_get_debug_info()
541 spl_ptr_llist_element *current = intern->llist->head; in spl_dllist_object_get_gc()
544 if (intern->gc_data_count < intern->llist->count) { in spl_dllist_object_get_gc()
545 intern->gc_data_count = intern->llist->count; in spl_dllist_object_get_gc()
572 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
590 spl_ptr_llist_unshift(intern->llist, value); in SPL_METHOD()
607 spl_ptr_llist_pop(intern->llist, return_value); in SPL_METHOD()
627 spl_ptr_llist_shift(intern->llist, return_value); in SPL_METHOD()
648 value = spl_ptr_llist_last(intern->llist); in SPL_METHOD()
671 value = spl_ptr_llist_first(intern->llist); in SPL_METHOD()
693 count = spl_ptr_llist_count(intern->llist); in SPL_METHOD()
769 RETURN_BOOL(index >= 0 && index < intern->llist->count); in SPL_METHOD()
788 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
793 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
819 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
827 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
832 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
836 if (intern->llist->dtor) { in SPL_METHOD()
837 intern->llist->dtor(element); in SPL_METHOD()
846 if (intern->llist->ctor) { in SPL_METHOD()
847 intern->llist->ctor(element); in SPL_METHOD()
865 spl_ptr_llist *llist; in SPL_METHOD() local
873 llist = intern->llist; in SPL_METHOD()
875 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
880 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
893 if (element == llist->head) { in SPL_METHOD()
894 llist->head = element->next; in SPL_METHOD()
897 if (element == llist->tail) { in SPL_METHOD()
898 llist->tail = element->prev; in SPL_METHOD()
902 llist->count--; in SPL_METHOD()
904 if(llist->dtor) { in SPL_METHOD()
905 llist->dtor(element); in SPL_METHOD()
933 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_rewind() argument
938 *traverse_position_ptr = llist->count-1; in spl_dllist_it_helper_rewind()
939 *traverse_pointer_ptr = llist->tail; in spl_dllist_it_helper_rewind()
942 *traverse_pointer_ptr = llist->head; in spl_dllist_it_helper_rewind()
949 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_move_forward() argument
960 spl_ptr_llist_pop(llist, &prev); in spl_dllist_it_helper_move_forward()
969 spl_ptr_llist_shift(llist, &prev); in spl_dllist_it_helper_move_forward()
987 spl_ptr_llist *llist = object->llist; in spl_dllist_it_rewind() local
989 …spl_dllist_it_helper_rewind(&iterator->traverse_pointer, &iterator->traverse_position, llist, obje… in spl_dllist_it_rewind()
1030 …e_forward(&iterator->traverse_pointer, &iterator->traverse_position, object->llist, object->flags); in spl_dllist_it_move_forward()
1058 …ve_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ S… in SPL_METHOD()
1072 …_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags); in SPL_METHOD()
1100 …spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, … in SPL_METHOD()
1131 spl_ptr_llist_element *current = intern->llist->head, *next; in SPL_METHOD()
1187 while (intern->llist->count > 0) { in SPL_METHOD()
1189 spl_ptr_llist_pop(intern->llist, &tmp); in SPL_METHOD()
1213 spl_ptr_llist_push(intern->llist, elem); in SPL_METHOD()
1234 spl_ptr_llist_element *current = intern->llist->head; in SPL_METHOD()
1248 array_init_size(&tmp, intern->llist->count); in SPL_METHOD()
1286 spl_ptr_llist_push(intern->llist, elem); in SPL_METHOD()
1308 if (index < 0 || index > intern->llist->count) { in SPL_METHOD()
1314 if (index == intern->llist->count) { in SPL_METHOD()
1316 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
1322 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
1332 intern->llist->head = elem; in SPL_METHOD()
1338 intern->llist->count++; in SPL_METHOD()
1340 if (intern->llist->ctor) { in SPL_METHOD()
1341 intern->llist->ctor(elem); in SPL_METHOD()