Lines Matching refs:llist

86 	spl_ptr_llist         *llist;  member
134 spl_ptr_llist *llist = emalloc(sizeof(spl_ptr_llist)); in spl_ptr_llist_init() local
136 llist->head = NULL; in spl_ptr_llist_init()
137 llist->tail = NULL; in spl_ptr_llist_init()
138 llist->count = 0; in spl_ptr_llist_init()
139 llist->dtor = dtor; in spl_ptr_llist_init()
140 llist->ctor = ctor; in spl_ptr_llist_init()
142 return llist; in spl_ptr_llist_init()
146 static zend_long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_count() argument
148 return (zend_long)llist->count; in spl_ptr_llist_count()
152 static void spl_ptr_llist_destroy(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_destroy() argument
154 spl_ptr_llist_element *current = llist->head, *next; in spl_ptr_llist_destroy()
155 spl_ptr_llist_dtor_func dtor = llist->dtor; in spl_ptr_llist_destroy()
166 efree(llist); in spl_ptr_llist_destroy()
170 static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, zend_long offset, int back… in spl_ptr_llist_offset() argument
177 current = llist->tail; in spl_ptr_llist_offset()
179 current = llist->head; in spl_ptr_llist_offset()
195 static void spl_ptr_llist_unshift(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_unshift() argument
201 elem->next = llist->head; in spl_ptr_llist_unshift()
204 if (llist->head) { in spl_ptr_llist_unshift()
205 llist->head->prev = elem; in spl_ptr_llist_unshift()
207 llist->tail = elem; in spl_ptr_llist_unshift()
210 llist->head = elem; in spl_ptr_llist_unshift()
211 llist->count++; in spl_ptr_llist_unshift()
213 if (llist->ctor) { in spl_ptr_llist_unshift()
214 llist->ctor(elem); in spl_ptr_llist_unshift()
219 static void spl_ptr_llist_push(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_push() argument
224 elem->prev = llist->tail; in spl_ptr_llist_push()
228 if (llist->tail) { in spl_ptr_llist_push()
229 llist->tail->next = elem; in spl_ptr_llist_push()
231 llist->head = elem; in spl_ptr_llist_push()
234 llist->tail = elem; in spl_ptr_llist_push()
235 llist->count++; in spl_ptr_llist_push()
237 if (llist->ctor) { in spl_ptr_llist_push()
238 llist->ctor(elem); in spl_ptr_llist_push()
243 static void spl_ptr_llist_pop(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_pop() argument
245 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_pop()
255 llist->head = NULL; in spl_ptr_llist_pop()
258 llist->tail = tail->prev; in spl_ptr_llist_pop()
259 llist->count--; in spl_ptr_llist_pop()
262 if (llist->dtor) { in spl_ptr_llist_pop()
263 llist->dtor(tail); in spl_ptr_llist_pop()
272 static zval *spl_ptr_llist_last(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_last() argument
274 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_last()
284 static zval *spl_ptr_llist_first(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_first() argument
286 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_first()
296 static void spl_ptr_llist_shift(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_shift() argument
298 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_shift()
308 llist->tail = NULL; in spl_ptr_llist_shift()
311 llist->head = head->next; in spl_ptr_llist_shift()
312 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()
543 spl_ptr_llist_element *current = intern->llist->head; in spl_dllist_object_get_gc()
546 if (intern->gc_data_count < intern->llist->count) { in spl_dllist_object_get_gc()
547 intern->gc_data_count = intern->llist->count; in spl_dllist_object_get_gc()
574 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
592 spl_ptr_llist_unshift(intern->llist, value); in SPL_METHOD()
609 spl_ptr_llist_pop(intern->llist, return_value); in SPL_METHOD()
629 spl_ptr_llist_shift(intern->llist, return_value); in SPL_METHOD()
650 value = spl_ptr_llist_last(intern->llist); in SPL_METHOD()
674 value = spl_ptr_llist_first(intern->llist); in SPL_METHOD()
697 count = spl_ptr_llist_count(intern->llist); in SPL_METHOD()
773 RETURN_BOOL(index >= 0 && index < intern->llist->count); in SPL_METHOD()
792 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
797 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
824 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
832 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
837 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
841 if (intern->llist->dtor) { in SPL_METHOD()
842 intern->llist->dtor(element); in SPL_METHOD()
851 if (intern->llist->ctor) { in SPL_METHOD()
852 intern->llist->ctor(element); in SPL_METHOD()
870 spl_ptr_llist *llist; in SPL_METHOD() local
878 llist = intern->llist; in SPL_METHOD()
880 if (index < 0 || index >= intern->llist->count) { in SPL_METHOD()
885 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
898 if (element == llist->head) { in SPL_METHOD()
899 llist->head = element->next; in SPL_METHOD()
902 if (element == llist->tail) { in SPL_METHOD()
903 llist->tail = element->prev; in SPL_METHOD()
907 llist->count--; in SPL_METHOD()
909 if(llist->dtor) { in SPL_METHOD()
910 llist->dtor(element); in SPL_METHOD()
938 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_rewind() argument
943 *traverse_position_ptr = llist->count-1; in spl_dllist_it_helper_rewind()
944 *traverse_pointer_ptr = llist->tail; in spl_dllist_it_helper_rewind()
947 *traverse_pointer_ptr = llist->head; in spl_dllist_it_helper_rewind()
954 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_move_forward() argument
965 spl_ptr_llist_pop(llist, &prev); in spl_dllist_it_helper_move_forward()
974 spl_ptr_llist_shift(llist, &prev); in spl_dllist_it_helper_move_forward()
992 spl_ptr_llist *llist = object->llist; in spl_dllist_it_rewind() local
994 …spl_dllist_it_helper_rewind(&iterator->traverse_pointer, &iterator->traverse_position, llist, obje… in spl_dllist_it_rewind()
1035 …e_forward(&iterator->traverse_pointer, &iterator->traverse_position, object->llist, object->flags); in spl_dllist_it_move_forward()
1063 …ve_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ S… in SPL_METHOD()
1077 …_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags); in SPL_METHOD()
1105 …spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, … in SPL_METHOD()
1137 spl_ptr_llist_element *current = intern->llist->head, *next; in SPL_METHOD()
1214 spl_ptr_llist_push(intern->llist, elem); in SPL_METHOD()
1247 if (index < 0 || index > intern->llist->count) { in SPL_METHOD()
1255 if (index == intern->llist->count) { in SPL_METHOD()
1257 spl_ptr_llist_push(intern->llist, value); in SPL_METHOD()
1263 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in SPL_METHOD()
1273 intern->llist->head = elem; in SPL_METHOD()
1279 intern->llist->count++; in SPL_METHOD()
1281 if (intern->llist->ctor) { in SPL_METHOD()
1282 intern->llist->ctor(elem); in SPL_METHOD()