From 03d5e7a7f15e020d447d04065fe727101f6f624c Mon Sep 17 00:00:00 2001 From: Etienne Kneuss Date: Fri, 29 Feb 2008 09:25:30 +0000 Subject: [PATCH] Fix #44288 (Move declarations) --- ext/spl/spl_heap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 39e7ddb079..862bc11422 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -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) { /* {{{ */ int i, j; const int limit = (heap->count-1)/2; + spl_ptr_heap_element top; + spl_ptr_heap_element bottom; if (heap->count == 0) { return NULL; } - spl_ptr_heap_element top = heap->elements[0]; - spl_ptr_heap_element bottom = heap->elements[--heap->count]; + top = heap->elements[0]; + bottom = heap->elements[--heap->count]; 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; spl_heap_it *iterator = (spl_heap_it *)iter; + spl_ptr_heap_element elem; 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); 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) { zval_ptr_dtor((zval **)&elem); -- 2.50.1