/* {{{ proto int SplHeap::isEmpty() Return true if the heap is empty. */ SPL_METHOD(SplHeap, isEmpty) { spl_heap_object *intern = Z_SPLHEAP_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(spl_ptr_heap_count(intern->heap) == 0); }
/* {{{ proto int SplHeap::count() Return the number of elements in the heap. */ SPL_METHOD(SplHeap, count) { zend_long count; spl_heap_object *intern = Z_SPLHEAP_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } count = spl_ptr_heap_count(intern->heap); RETURN_LONG(count); }
static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */ { spl_heap_object *intern = Z_SPLHEAP_P(object); if (intern->fptr_count) { zval rv; zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); return SUCCESS; } *count = 0; return FAILURE; } *count = spl_ptr_heap_count(intern->heap); return SUCCESS; }
static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */ { spl_heap_object *intern = Z_SPLHEAP_P(object); if (intern->fptr_count) { zval rv; zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_long(&intern->retval); *count = (zend_long) Z_LVAL(intern->retval); return SUCCESS; } *count = 0; return FAILURE; } *count = spl_ptr_heap_count(intern->heap); return SUCCESS; }