~legolas/ubuntu/natty/php5/5.3.5

« back to all changes in this revision

Viewing changes to ext/spl/spl_heap.c

  • Committer: Stas Verberkt
  • Date: 2011-02-01 09:27:15 UTC
  • Revision ID: legolas@legolasweb.nl-20110201092715-yq052iu2yl4i2eyg
Inserted PHP 5.3.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
   +----------------------------------------------------------------------+
17
17
 */
18
18
 
19
 
/* $Id: spl_heap.c 293036 2010-01-03 09:23:27Z sebastian $ */
 
19
/* $Id: spl_heap.c 305335 2010-11-14 18:40:08Z felipe $ */
20
20
 
21
21
#ifdef HAVE_CONFIG_H
22
22
# include "config.h"
982
982
{
983
983
        spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
984
984
        
 
985
        if (zend_parse_parameters_none() == FAILURE) {
 
986
                return;
 
987
        }               
 
988
        
985
989
        RETURN_LONG(intern->heap->count - 1);
986
990
}
987
991
/* }}} */
992
996
{
993
997
        spl_heap_object      *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
994
998
        spl_ptr_heap_element  elem   = spl_ptr_heap_delete_top(intern->heap, getThis() TSRMLS_CC);
 
999
        
 
1000
        if (zend_parse_parameters_none() == FAILURE) {
 
1001
                return;
 
1002
        }
995
1003
 
996
1004
        if (elem != NULL) {
997
1005
                zval_ptr_dtor((zval **)&elem);
1004
1012
SPL_METHOD(SplHeap, valid)
1005
1013
{
1006
1014
        spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
1015
        
 
1016
        if (zend_parse_parameters_none() == FAILURE) {
 
1017
                return;
 
1018
        }
1007
1019
 
1008
1020
        RETURN_BOOL(intern->heap->count != 0);
1009
1021
}
1013
1025
   Rewind the datastructure back to the start */
1014
1026
SPL_METHOD(SplHeap, rewind)
1015
1027
{
 
1028
        if (zend_parse_parameters_none() == FAILURE) {
 
1029
                return;
 
1030
        }
1016
1031
        /* do nothing, the iterator always points to the top element */
1017
1032
}
1018
1033
/* }}} */
1023
1038
{
1024
1039
        spl_heap_object *intern  = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
1025
1040
        zval            *element = (zval *)intern->heap->elements[0];
 
1041
        
 
1042
        if (zend_parse_parameters_none() == FAILURE) {
 
1043
                return;
 
1044
        }
1026
1045
 
1027
1046
        if (!intern->heap->count || !element) {
1028
1047
                RETURN_NULL();
1038
1057
{
1039
1058
        spl_heap_object  *intern  = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
1040
1059
        zval            **element = (zval **)&intern->heap->elements[0];
 
1060
        
 
1061
        if (zend_parse_parameters_none() == FAILURE) {
 
1062
                return;
 
1063
        }
1041
1064
 
1042
1065
        if (!intern->heap->count || !*element) {
1043
1066
                RETURN_NULL();