mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fix #44288 (Move declarations)
This commit is contained in:
parent
0aadbbf12d
commit
03d5e7a7f1
1 changed files with 6 additions and 3 deletions
|
@ -273,13 +273,15 @@ static spl_ptr_heap_element spl_ptr_heap_top(spl_ptr_heap *heap) { /* {{{ */
|
||||||
static spl_ptr_heap_element spl_ptr_heap_delete_top(spl_ptr_heap *heap, void *cmp_userdata TSRMLS_DC) { /* {{{ */
|
static spl_ptr_heap_element spl_ptr_heap_delete_top(spl_ptr_heap *heap, void *cmp_userdata TSRMLS_DC) { /* {{{ */
|
||||||
int i, j;
|
int i, j;
|
||||||
const int limit = (heap->count-1)/2;
|
const int limit = (heap->count-1)/2;
|
||||||
|
spl_ptr_heap_element top;
|
||||||
|
spl_ptr_heap_element bottom;
|
||||||
|
|
||||||
if (heap->count == 0) {
|
if (heap->count == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_ptr_heap_element top = heap->elements[0];
|
top = heap->elements[0];
|
||||||
spl_ptr_heap_element bottom = heap->elements[--heap->count];
|
bottom = heap->elements[--heap->count];
|
||||||
|
|
||||||
for( i = 0; i < limit; i = j)
|
for( i = 0; i < limit; i = j)
|
||||||
{
|
{
|
||||||
|
@ -920,13 +922,14 @@ static void spl_heap_it_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{
|
||||||
{
|
{
|
||||||
zval *object = (zval*)((zend_user_iterator *)iter)->it.data;
|
zval *object = (zval*)((zend_user_iterator *)iter)->it.data;
|
||||||
spl_heap_it *iterator = (spl_heap_it *)iter;
|
spl_heap_it *iterator = (spl_heap_it *)iter;
|
||||||
|
spl_ptr_heap_element elem;
|
||||||
|
|
||||||
if (iterator->object->heap->flags & SPL_HEAP_CORRUPTED) {
|
if (iterator->object->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0 TSRMLS_CC);
|
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_ptr_heap_element elem = spl_ptr_heap_delete_top(iterator->object->heap, object TSRMLS_CC);
|
elem = spl_ptr_heap_delete_top(iterator->object->heap, object TSRMLS_CC);
|
||||||
|
|
||||||
if (elem != NULL) {
|
if (elem != NULL) {
|
||||||
zval_ptr_dtor((zval **)&elem);
|
zval_ptr_dtor((zval **)&elem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue