diff options
Diffstat (limited to 'ext/spl/spl_fixedarray.c')
-rw-r--r-- | ext/spl/spl_fixedarray.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 8b3486d627..6109b35b6d 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -43,7 +43,7 @@ ZEND_GET_MODULE(spl_fixedarray) #endif typedef struct _spl_fixedarray { /* {{{ */ - long size; + php_int_t size; zval *elements; } spl_fixedarray; /* }}} */ @@ -81,7 +81,7 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj) #define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv))) -static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size > 0) { array->size = 0; /* reset size in case ecalloc() fails */ @@ -94,7 +94,7 @@ static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* { } /* }}} */ -static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size == array->size) { /* nothing to do */ @@ -109,7 +109,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* /* clearing the array */ if (size == 0) { - long i; + php_int_t i; for (i = 0; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -123,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0); memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size)); } else { /* size < array->size */ - long i; + php_int_t i; for (i = size; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -194,7 +194,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* { static void spl_fixedarray_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern = spl_fixed_array_from_obj(object); - long i; + php_int_t i; if (intern->array) { for (i = 0; i < intern->array->size; i++) { @@ -328,7 +328,7 @@ static zend_object *spl_fixedarray_object_clone(zval *zobject TSRMLS_DC) /* {{{ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; /* we have to return NULL on error here to avoid memleak because of * ZE duplicating uninitialized_zval_ptr */ @@ -384,7 +384,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; if (!offset) { /* '$array[] = value' syntax is not supported */ @@ -438,7 +438,7 @@ static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zv static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; if (Z_TYPE_P(offset) != IS_INT) { index = spl_offset_convert_to_int(offset TSRMLS_CC); @@ -476,7 +476,7 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset TSR static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_object *intern, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; int retval; if (Z_TYPE_P(offset) != IS_INT) { @@ -528,7 +528,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c } /* }}} */ -static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern; @@ -540,7 +540,7 @@ static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_int(&intern->retval); - *count = (long) Z_IVAL(intern->retval); + *count = (php_int_t) Z_IVAL(intern->retval); return SUCCESS; } } else if (intern->array) { @@ -559,9 +559,9 @@ SPL_METHOD(SplFixedArray, __construct) { zval *object = getThis(); spl_fixedarray_object *intern; - long size = 0; + php_int_t size = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &size) == FAILURE) { return; } @@ -684,11 +684,11 @@ SPL_METHOD(SplFixedArray, fromArray) if (num > 0 && save_indexes) { zval *element; zend_string *str_index; - ulong num_index, max_index = 0; - long tmp; + php_uint_t num_index, max_index = 0; + php_int_t tmp; ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) { - if (str_index != NULL || (long)num_index < 0) { + if (str_index != NULL || (php_int_t)num_index < 0) { efree(array); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "array must contain only positive integer keys"); return; @@ -714,7 +714,7 @@ SPL_METHOD(SplFixedArray, fromArray) } else if (num > 0 && !save_indexes) { zval *element; - long i = 0; + php_int_t i = 0; spl_fixedarray_init(array, num TSRMLS_CC); @@ -759,7 +759,7 @@ SPL_METHOD(SplFixedArray, setSize) { zval *object = getThis(); spl_fixedarray_object *intern; - long size; + php_int_t size; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { return; |