diff options
Diffstat (limited to 'ext/spl/spl_heap.c')
| -rw-r--r-- | ext/spl/spl_heap.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index d06337733..bb164d84c 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_heap.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: spl_heap.c 305335 2010-11-14 18:40:08Z felipe $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -982,6 +982,10 @@ SPL_METHOD(SplHeap, key) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->heap->count - 1); } /* }}} */ @@ -992,6 +996,10 @@ SPL_METHOD(SplHeap, next) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_ptr_heap_element elem = spl_ptr_heap_delete_top(intern->heap, getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (elem != NULL) { zval_ptr_dtor((zval **)&elem); @@ -1004,6 +1012,10 @@ SPL_METHOD(SplHeap, next) SPL_METHOD(SplHeap, valid) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(intern->heap->count != 0); } @@ -1013,6 +1025,9 @@ SPL_METHOD(SplHeap, valid) Rewind the datastructure back to the start */ SPL_METHOD(SplHeap, rewind) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* do nothing, the iterator always points to the top element */ } /* }}} */ @@ -1023,6 +1038,10 @@ SPL_METHOD(SplHeap, current) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval *element = (zval *)intern->heap->elements[0]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!intern->heap->count || !element) { RETURN_NULL(); @@ -1038,6 +1057,10 @@ SPL_METHOD(SplPriorityQueue, current) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval **element = (zval **)&intern->heap->elements[0]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!intern->heap->count || !*element) { RETURN_NULL(); |
