Lines Matching refs:llist

84 	spl_ptr_llist         *llist;  member
130 spl_ptr_llist *llist = emalloc(sizeof(spl_ptr_llist)); in spl_ptr_llist_init() local
132 llist->head = NULL; in spl_ptr_llist_init()
133 llist->tail = NULL; in spl_ptr_llist_init()
134 llist->count = 0; in spl_ptr_llist_init()
135 llist->dtor = dtor; in spl_ptr_llist_init()
136 llist->ctor = ctor; in spl_ptr_llist_init()
138 return llist; in spl_ptr_llist_init()
142 static zend_long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_count() argument
144 return (zend_long)llist->count; in spl_ptr_llist_count()
148 static void spl_ptr_llist_destroy(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_destroy() argument
150 spl_ptr_llist_element *current = llist->head, *next; in spl_ptr_llist_destroy()
151 spl_ptr_llist_dtor_func dtor = llist->dtor; in spl_ptr_llist_destroy()
162 efree(llist); in spl_ptr_llist_destroy()
166 static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, zend_long offset, int back… in spl_ptr_llist_offset() argument
173 current = llist->tail; in spl_ptr_llist_offset()
175 current = llist->head; in spl_ptr_llist_offset()
191 static void spl_ptr_llist_unshift(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_unshift() argument
196 elem->next = llist->head; in spl_ptr_llist_unshift()
200 if (llist->head) { in spl_ptr_llist_unshift()
201 llist->head->prev = elem; in spl_ptr_llist_unshift()
203 llist->tail = elem; in spl_ptr_llist_unshift()
206 llist->head = elem; in spl_ptr_llist_unshift()
207 llist->count++; in spl_ptr_llist_unshift()
209 if (llist->ctor) { in spl_ptr_llist_unshift()
210 llist->ctor(elem); in spl_ptr_llist_unshift()
215 static void spl_ptr_llist_push(spl_ptr_llist *llist, zval *data) /* {{{ */ in spl_ptr_llist_push() argument
219 elem->prev = llist->tail; in spl_ptr_llist_push()
224 if (llist->tail) { in spl_ptr_llist_push()
225 llist->tail->next = elem; in spl_ptr_llist_push()
227 llist->head = elem; in spl_ptr_llist_push()
230 llist->tail = elem; in spl_ptr_llist_push()
231 llist->count++; in spl_ptr_llist_push()
233 if (llist->ctor) { in spl_ptr_llist_push()
234 llist->ctor(elem); in spl_ptr_llist_push()
239 static void spl_ptr_llist_pop(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_pop() argument
241 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_pop()
251 llist->head = NULL; in spl_ptr_llist_pop()
254 llist->tail = tail->prev; in spl_ptr_llist_pop()
255 llist->count--; in spl_ptr_llist_pop()
259 if (llist->dtor) { in spl_ptr_llist_pop()
260 llist->dtor(tail); in spl_ptr_llist_pop()
269 static zval *spl_ptr_llist_last(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_last() argument
271 spl_ptr_llist_element *tail = llist->tail; in spl_ptr_llist_last()
281 static zval *spl_ptr_llist_first(spl_ptr_llist *llist) /* {{{ */ in spl_ptr_llist_first() argument
283 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_first()
293 static void spl_ptr_llist_shift(spl_ptr_llist *llist, zval *ret) /* {{{ */ in spl_ptr_llist_shift() argument
295 spl_ptr_llist_element *head = llist->head; in spl_ptr_llist_shift()
305 llist->tail = NULL; in spl_ptr_llist_shift()
308 llist->head = head->next; in spl_ptr_llist_shift()
309 llist->count--; in spl_ptr_llist_shift()
313 if (llist->dtor) { in spl_ptr_llist_shift()
314 llist->dtor(head); in spl_ptr_llist_shift()
352 while (intern->llist->count > 0) { in spl_dllist_object_free_storage()
353 spl_ptr_llist_pop(intern->llist, &tmp); in spl_dllist_object_free_storage()
357 spl_ptr_llist_destroy(intern->llist); in spl_dllist_object_free_storage()
381 intern->llist = (spl_ptr_llist *)spl_ptr_llist_init(other->llist->ctor, other->llist->dtor); in spl_dllist_object_new_ex()
382 spl_ptr_llist_copy(other->llist, intern->llist); in spl_dllist_object_new_ex()
383 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
386 intern->llist = other->llist; in spl_dllist_object_new_ex()
387 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
393 …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()
394 intern->traverse_pointer = intern->llist->head; in spl_dllist_object_new_ex()
477 *count = spl_ptr_llist_count(intern->llist); in spl_dllist_object_count_elements()
485 spl_ptr_llist_element *current = intern->llist->head, *next; in spl_dllist_object_get_debug_info()
529 spl_ptr_llist_element *current = intern->llist->head; in spl_dllist_object_get_gc()
552 spl_ptr_llist_push(intern->llist, value); in PHP_METHOD()
567 spl_ptr_llist_unshift(intern->llist, value); in PHP_METHOD()
581 spl_ptr_llist_pop(intern->llist, return_value); in PHP_METHOD()
600 spl_ptr_llist_shift(intern->llist, return_value); in PHP_METHOD()
620 value = spl_ptr_llist_last(intern->llist); in PHP_METHOD()
642 value = spl_ptr_llist_first(intern->llist); in PHP_METHOD()
663 count = spl_ptr_llist_count(intern->llist); in PHP_METHOD()
733 RETURN_BOOL(index >= 0 && index < intern->llist->count); in PHP_METHOD()
749 if (index < 0 || index >= intern->llist->count) { in PHP_METHOD()
754 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in PHP_METHOD()
779 spl_ptr_llist_push(intern->llist, value); in PHP_METHOD()
784 if (index < 0 || index >= intern->llist->count) { in PHP_METHOD()
789 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in PHP_METHOD()
793 if (intern->llist->dtor) { in PHP_METHOD()
794 intern->llist->dtor(element); in PHP_METHOD()
803 if (intern->llist->ctor) { in PHP_METHOD()
804 intern->llist->ctor(element); in PHP_METHOD()
820 spl_ptr_llist *llist; in PHP_METHOD() local
827 llist = intern->llist; in PHP_METHOD()
829 if (index < 0 || index >= intern->llist->count) { in PHP_METHOD()
834 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in PHP_METHOD()
847 if (element == llist->head) { in PHP_METHOD()
848 llist->head = element->next; in PHP_METHOD()
851 if (element == llist->tail) { in PHP_METHOD()
852 llist->tail = element->prev; in PHP_METHOD()
856 llist->count--; in PHP_METHOD()
858 if(llist->dtor) { in PHP_METHOD()
859 llist->dtor(element); in PHP_METHOD()
887 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_rewind() argument
892 *traverse_position_ptr = llist->count-1; in spl_dllist_it_helper_rewind()
893 *traverse_pointer_ptr = llist->tail; in spl_dllist_it_helper_rewind()
896 *traverse_pointer_ptr = llist->head; in spl_dllist_it_helper_rewind()
903 …lement **traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int flags) /* {{{… in spl_dllist_it_helper_move_forward() argument
914 spl_ptr_llist_pop(llist, &prev); in spl_dllist_it_helper_move_forward()
923 spl_ptr_llist_shift(llist, &prev); in spl_dllist_it_helper_move_forward()
941 spl_ptr_llist *llist = object->llist; in spl_dllist_it_rewind() local
943 …spl_dllist_it_helper_rewind(&iterator->traverse_pointer, &iterator->traverse_position, llist, iter… in spl_dllist_it_rewind()
984 …forward(&iterator->traverse_pointer, &iterator->traverse_position, object->llist, iterator->flags); in spl_dllist_it_move_forward()
1010 …ve_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ S… in PHP_METHOD()
1023 …_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags); in PHP_METHOD()
1049 …spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, … in PHP_METHOD()
1076 spl_ptr_llist_element *current = intern->llist->head, *next; in PHP_METHOD()
1126 while (intern->llist->count > 0) { in PHP_METHOD()
1128 spl_ptr_llist_pop(intern->llist, &tmp); in PHP_METHOD()
1152 spl_ptr_llist_push(intern->llist, elem); in PHP_METHOD()
1173 spl_ptr_llist_element *current = intern->llist->head; in PHP_METHOD()
1187 array_init_size(&tmp, intern->llist->count); in PHP_METHOD()
1225 spl_ptr_llist_push(intern->llist, elem); in PHP_METHOD()
1245 if (index < 0 || index > intern->llist->count) { in PHP_METHOD()
1251 if (index == intern->llist->count) { in PHP_METHOD()
1253 spl_ptr_llist_push(intern->llist, value); in PHP_METHOD()
1259 element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); in PHP_METHOD()
1269 intern->llist->head = elem; in PHP_METHOD()
1275 intern->llist->count++; in PHP_METHOD()
1277 if (intern->llist->ctor) { in PHP_METHOD()
1278 intern->llist->ctor(elem); in PHP_METHOD()