/ext-ds/src/ds/ |
H A D | ds_queue.c | 13 queue->deque = deque; in ds_queue_ex() 14 return queue; in ds_queue_ex() 27 void ds_queue_free(ds_queue_t *queue) in ds_queue_free() argument 29 ds_deque_free(queue->deque); in ds_queue_free() 30 efree(queue); in ds_queue_free() 40 return queue->deque->capacity; in ds_queue_capacity() 50 ds_deque_push(queue->deque, value); in ds_queue_push_one() 53 void ds_queue_clear(ds_queue_t *queue) in ds_queue_clear() argument 55 ds_deque_clear(queue->deque); in ds_queue_clear() 65 zend_long size = QUEUE_SIZE(queue); in ds_queue_to_array() [all …]
|
H A D | ds_priority_queue.c | 56 queue->nodes = reallocate_nodes(queue->nodes, capacity); in reallocate_to_capacity() 62 reallocate_to_capacity(queue, queue->capacity * 2); in increase_capacity() 83 return queue; in ds_priority_queue() 101 if (queue->size == queue->capacity) { in ds_priority_queue_push() 134 queue->size++; in ds_priority_queue_push() 139 …if (queue->size <= (queue->capacity / 4) && (queue->capacity / 2) >= DS_PRIORITY_QUEUE_MIN_CAPACIT… in ds_priority_queue_compact() 140 reallocate_to_capacity(queue, queue->capacity / 2); in ds_priority_queue_compact() 174 queue->size--; in ds_priority_queue_pop() 203 ds_priority_queue_node_t *end = queue->nodes + queue->size; in copy_nodes() 280 ds_priority_queue_node_t *end = queue->nodes + queue->size; in ds_priority_queue_clear() [all …]
|
H A D | ds_priority_queue.h | 20 #define DS_PRIORITY_QUEUE_FOREACH_NODE(queue, node) \ argument 22 ds_priority_queue_t *_queue = queue; \ 24 ds_priority_queue_node_t *_last = &_queue->nodes[queue->size - 1]; \ 30 #define DS_PRIORITY_QUEUE_FOREACH_VALUE(queue, value) \ argument 32 DS_PRIORITY_QUEUE_FOREACH_NODE(queue, __node) \ 54 #define DS_PRIORITY_QUEUE_SIZE(queue) ((queue)->size) argument 55 #define DS_PRIORITY_QUEUE_IS_EMPTY(queue) (DS_PRIORITY_QUEUE_SIZE(queue) == 0) argument 61 uint32_t ds_priority_queue_capacity(ds_priority_queue_t *queue); 63 zval *ds_priority_queue_peek(ds_priority_queue_t *queue); 71 void ds_priority_queue_free(ds_priority_queue_t *queue); [all …]
|
H A D | ds_queue.h | 10 #define QUEUE_FOREACH(queue, value) \ argument 13 while ( ! DS_DEQUE_IS_EMPTY(queue->deque)) { \ 14 ds_deque_shift(queue->deque, &_tmp); \ 28 ds_queue_t *ds_queue_clone(ds_queue_t *queue); 31 zend_long ds_queue_capacity(ds_queue_t *queue); 33 void ds_queue_push(ds_queue_t *queue, VA_PARAMS); 34 void ds_queue_push_one(ds_queue_t *queue, zval *value); 35 void ds_queue_clear(ds_queue_t *queue); 38 zval *ds_queue_peek(ds_queue_t *queue); 39 zval *ds_queue_peek_throw(ds_queue_t *queue); [all …]
|
/ext-ds/src/php/handlers/ |
H A D | php_queue_handlers.c | 13 ds_queue_t *queue = php_ds_queue_fetch_object(obj)->queue; local 19 ds_queue_push_one(queue, value); 28 ds_queue_free(queue->queue); 29 zend_object_std_dtor(&queue->std); 35 ds_queue_t *queue = php_ds_queue_fetch_object(obj)->queue; local 40 *count = QUEUE_SIZE(queue); 47 ds_queue_t *queue = php_ds_queue_fetch_object(obj)->queue; local 58 ds_queue_t *queue = php_ds_queue_fetch_object(obj)->queue; local 65 ds_queue_to_array(queue, &arr); 72 ds_queue_t *queue = php_ds_queue_fetch_object(obj)->queue; local [all …]
|
H A D | php_priority_queue_handlers.c | 11 php_ds_priority_queue_t *queue = php_ds_priority_queue_fetch_object(object); in php_ds_priority_queue_free_object() local 12 ds_priority_queue_free(queue->queue); in php_ds_priority_queue_free_object() 14 if (queue->gc_data != NULL) { in php_ds_priority_queue_free_object() 15 efree(queue->gc_data); in php_ds_priority_queue_free_object() 17 zend_object_std_dtor(&queue->std); in php_ds_priority_queue_free_object() 23 ds_priority_queue_t *pq = php_ds_priority_queue_fetch_object(obj)->queue; 35 ds_priority_queue_t *pq = php_ds_priority_queue_fetch_object(obj)->queue; 46 ds_priority_queue_t *pq = php_ds_priority_queue_fetch_object(obj)->queue; 60 ds_priority_queue_t *pq = php_ds_priority_queue_fetch_object(obj)->queue;
|
/ext-ds/src/php/objects/ |
H A D | php_priority_queue.h | 7 ds_priority_queue_t *queue; member 17 #define Z_DS_PRIORITY_QUEUE(z) (php_ds_priority_queue_fetch_object(Z_OBJ(z))->queue) 21 #define ZVAL_DS_PRIORITY_QUEUE(z, queue) \ argument 22 ZVAL_OBJ(z, (php_ds_priority_queue_create_object_ex(queue))) 24 #define RETURN_DS_PRIORITY_QUEUE(queue) \ argument 26 ds_priority_queue_t *_queue = queue; \ 35 zend_object *php_ds_priority_queue_create_object_ex(ds_priority_queue_t *queue); 37 zend_object *php_ds_priority_queue_create_clone(ds_priority_queue_t *queue);
|
H A D | php_queue.c | 7 zend_object *php_ds_queue_create_object_ex(ds_queue_t *queue) in php_ds_queue_create_object_ex() argument 16 obj->queue = queue; in php_ds_queue_create_object_ex() 26 zend_object *php_ds_queue_create_clone(ds_queue_t *queue) in php_ds_queue_create_clone() argument 28 return php_ds_queue_create_object_ex(ds_queue_clone(queue)); in php_ds_queue_create_clone() 33 ds_queue_t *queue = Z_DS_QUEUE_P(object); in php_ds_queue_serialize() local 38 if (QUEUE_SIZE(queue) == 0) { in php_ds_queue_serialize() 46 DS_DEQUE_FOREACH(queue->deque, value) { in php_ds_queue_serialize() 62 ds_queue_t *queue = ds_queue(); in php_ds_queue_unserialize() local 78 ds_queue_push_one(queue, value); in php_ds_queue_unserialize() 81 ZVAL_DS_QUEUE(object, queue); in php_ds_queue_unserialize() [all …]
|
H A D | php_priority_queue.c | 7 zend_object *php_ds_priority_queue_create_object_ex(ds_priority_queue_t *queue) in php_ds_priority_queue_create_object_ex() argument 17 obj->queue = queue; in php_ds_priority_queue_create_object_ex() 30 zend_object *php_ds_priority_queue_create_clone(ds_priority_queue_t *queue) in php_ds_priority_queue_create_clone() argument 32 return php_ds_priority_queue_create_object_ex(ds_priority_queue_clone(queue)); in php_ds_priority_queue_create_clone() 38 ds_priority_queue_t *queue = Z_DS_PRIORITY_QUEUE_P(object); in php_ds_priority_queue_serialize() local 43 if (queue->size == 0) { in php_ds_priority_queue_serialize() 49 ds_priority_queue_node_t *end = nodes + queue->size; in php_ds_priority_queue_serialize() 71 ds_priority_queue_t *queue = ds_priority_queue(); in php_ds_priority_queue_unserialize() local 79 ZVAL_DS_PRIORITY_QUEUE(object, queue); in php_ds_priority_queue_unserialize() 95 ds_priority_queue_push(queue, value, priority); in php_ds_priority_queue_unserialize() [all …]
|
H A D | php_queue.h | 7 ds_queue_t *queue; member 15 #define Z_DS_QUEUE(z) php_ds_queue_fetch_object(Z_OBJ(z))->queue 19 #define ZVAL_DS_QUEUE(z, queue) \ argument 20 ZVAL_OBJ(z, php_ds_queue_create_object_ex(queue)) 33 zend_object *php_ds_queue_create_object_ex(ds_queue_t *queue); 35 zend_object *php_ds_queue_create_clone(ds_queue_t *queue);
|
/ext-ds/src/php/iterators/ |
H A D | php_queue_iterator.c | 26 static void php_ds_queue_iterator_set_current(ds_queue_t *queue, zval *data) in php_ds_queue_iterator_set_current() argument 28 if (QUEUE_IS_EMPTY(queue)) { in php_ds_queue_iterator_set_current() 31 ds_queue_pop(queue, data); in php_ds_queue_iterator_set_current() 39 php_ds_queue_iterator_set_current(iterator->queue, &iter->data); in php_ds_queue_iterator_move_forward() 46 php_ds_queue_iterator_set_current(iterator->queue, &iter->data); in php_ds_queue_iterator_rewind() 72 iterator->queue = Z_DS_QUEUE_P(object); in php_ds_queue_get_iterator()
|
H A D | php_priority_queue_iterator.c | 29 static void php_ds_priority_queue_iterator_set_current(ds_priority_queue_t *queue, zval *data) in php_ds_priority_queue_iterator_set_current() argument 31 if (DS_PRIORITY_QUEUE_IS_EMPTY(queue)) { in php_ds_priority_queue_iterator_set_current() 34 ds_priority_queue_pop(queue, data); in php_ds_priority_queue_iterator_set_current() 42 php_ds_priority_queue_iterator_set_current(iterator->queue, &iter->data); in php_ds_priority_queue_iterator_move_forward() 49 php_ds_priority_queue_iterator_set_current(iterator->queue, &iter->data); in php_ds_priority_queue_iterator_rewind() 77 iterator->queue = Z_DS_PRIORITY_QUEUE_P(object); in php_ds_priority_queue_get_iterator()
|
H A D | php_priority_queue_iterator.h | 10 ds_priority_queue_t *queue; member
|
H A D | php_queue_iterator.h | 11 ds_queue_t *queue; member
|