summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl')
-rwxr-xr-xext/spl/php_spl.c2
-rwxr-xr-xext/spl/spl_array.c32
-rwxr-xr-xext/spl/spl_directory.c6
-rwxr-xr-xext/spl/spl_engine.c4
-rwxr-xr-xext/spl/spl_iterators.c18
-rwxr-xr-xext/spl/spl_observer.c2
6 files changed, 32 insertions, 32 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index c4c3948344..cc88d91906 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -468,7 +468,7 @@ PHP_FUNCTION(spl_autoload_register)
func_name_len += sizeof(zend_object_handle);
lc_name[func_name_len] = '\0';
alfi.obj = *obj_ptr;
- alfi.obj->refcount++;
+ Z_ADDREF_P(alfi.obj);
} else {
alfi.obj = NULL;
}
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 7fa11bd882..cc6ee0e658 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -152,11 +152,11 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s
zend_hash_copy(HASH_OF(intern->array), HASH_OF(other->array), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*));
}
if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator) {
- ZVAL_ADDREF(other->array);
+ Z_ADDREF_P(other->array);
}
} else {
intern->array = orig;
- ZVAL_ADDREF(intern->array);
+ Z_ADDREF_P(intern->array);
intern->ar_flags |= SPL_ARRAY_IS_REF | SPL_ARRAY_USE_OTHER;
}
} else {
@@ -320,22 +320,22 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
/* When in a write context,
* ZE has to be fooled into thinking this is in a reference set
* by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */
- if ((type == BP_VAR_W || type == BP_VAR_RW) && !(*ret)->is_ref) {
- if ((*ret)->refcount > 1) {
+ if ((type == BP_VAR_W || type == BP_VAR_RW) && !Z_ISREF_PP(ret)) {
+ if (Z_REFCOUNT_PP(ret) > 1) {
zval *newval;
/* Separate */
MAKE_STD_ZVAL(newval);
*newval = **ret;
zval_copy_ctor(newval);
- newval->refcount = 1;
+ Z_SET_REFCOUNT_P(newval, 1);
/* Replace */
- (*ret)->refcount--;
+ Z_DELREF_PP(ret);
*ret = newval;
}
- (*ret)->is_ref = 1;
+ Z_SET_ISREF_PP(ret);
}
return *ret;
@@ -363,7 +363,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
}
if (!offset) {
- value->refcount++;
+ Z_ADDREF_P(value);
zend_hash_next_index_insert(spl_array_get_hash_table(intern, 0 TSRMLS_CC), (void**)&value, sizeof(void*), NULL);
return;
}
@@ -373,7 +373,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC);
return;
}
- value->refcount++;
+ Z_ADDREF_P(value);
zend_symtable_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
return;
case IS_DOUBLE:
@@ -385,11 +385,11 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
} else {
index = Z_LVAL_P(offset);
}
- value->refcount++;
+ Z_ADDREF_P(value);
zend_hash_index_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index, (void**)&value, sizeof(void*), NULL);
return;
case IS_NULL:
- value->refcount++;
+ Z_ADDREF_P(value);
zend_hash_next_index_insert(spl_array_get_hash_table(intern, 0 TSRMLS_CC), (void**)&value, sizeof(void*), NULL);
return;
default:
@@ -873,7 +873,7 @@ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object,
iterator = emalloc(sizeof(spl_array_it));
- object->refcount++;
+ Z_ADDREF_P(object);
iterator->intern.it.data = (void*)object;
iterator->intern.it.funcs = &spl_array_it_funcs;
iterator->intern.ce = ce;
@@ -949,7 +949,7 @@ SPL_METHOD(Array, __construct)
intern->ar_flags &= ~SPL_ARRAY_IS_SELF;
}
intern->ar_flags |= ar_flags;
- ZVAL_ADDREF(intern->array);
+ Z_ADDREF_P(intern->array);
if (Z_TYPE_PP(array) == IS_OBJECT) {
zend_object_get_properties_t handler = Z_OBJ_HANDLER_PP(array, get_properties);
if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties)
@@ -1063,7 +1063,7 @@ SPL_METHOD(Array, exchangeArray)
} else {
intern->ar_flags &= ~SPL_ARRAY_IS_SELF;
}
- ZVAL_ADDREF(intern->array);
+ Z_ADDREF_P(intern->array);
spl_array_rewind(intern TSRMLS_CC);
}
@@ -1085,8 +1085,8 @@ SPL_METHOD(Array, getIterator)
return_value->type = IS_OBJECT;
return_value->value.obj = spl_array_object_new_ex(intern->ce_get_iterator, &iterator, object, 0 TSRMLS_CC);
- return_value->refcount = 1;
- return_value->is_ref = 1;
+ Z_SET_REFCOUNT_P(return_value, 1);
+ Z_SET_ISREF_P(return_value);
}
/* }}} */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 1b122af5f4..bf3eb83f5a 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -231,7 +231,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
/* avoid reference counting in debug mode, thus do it manually */
ZVAL_RESOURCE(&intern->u.file.zresource, php_stream_get_resource_id(intern->u.file.stream));
- intern->u.file.zresource.refcount = 1;
+ Z_SET_REFCOUNT(intern->u.file.zresource, 1);
intern->u.file.delimiter = ',';
intern->u.file.enclosure = '"';
@@ -1140,7 +1140,7 @@ zend_object_iterator *spl_filesystem_dir_get_iterator(zend_class_entry *ce, zval
iterator = emalloc(sizeof(spl_filesystem_dir_it));
dir_object = (spl_filesystem_object*)zend_object_store_get_object(object TSRMLS_CC);
- object->refcount += 2;;
+ Z_SET_REFCOUNT_P(object, Z_REFCOUNT_P(object) + 2);
iterator->intern.data = (void*)object;
iterator->intern.funcs = &spl_filesystem_dir_it_funcs;
iterator->current = object;
@@ -1351,7 +1351,7 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva
iterator = emalloc(sizeof(spl_filesystem_dir_it));
dir_object = (spl_filesystem_object*)zend_object_store_get_object(object TSRMLS_CC);
- object->refcount++;
+ Z_ADDREF_P(object);
iterator->intern.data = (void*)object;
iterator->intern.funcs = &spl_filesystem_tree_it_funcs;
iterator->current = NULL;
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 9404e8e24c..27814ee543 100755
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -38,8 +38,8 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRM
ALLOC_ZVAL(*object);
}
object_init_ex(*object, pce);
- (*object)->refcount = 1;
- (*object)->is_ref = 1; /* check if this can be hold always */
+ Z_SET_REFCOUNT_PP(object, 1);
+ Z_SET_ISREF_PP(object); /* check if this can be hold always */
}
/* }}} */
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 5c1fe4d722..a1bb2f008c 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -392,7 +392,7 @@ static zend_object_iterator *spl_recursive_it_get_iterator(zend_class_entry *ce,
iterator = emalloc(sizeof(spl_recursive_it_iterator));
object = (spl_recursive_it_object*)zend_object_store_get_object(zobject TSRMLS_CC);
- zobject->refcount++;
+ Z_ADDREF_P(zobject);
iterator->intern.data = (void*)object;
iterator->intern.funcs = ce->iterator_funcs.funcs;
iterator->zobject = zobject;
@@ -479,7 +479,7 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */
intern->iterators[0].iterator = ce_iterator->get_iterator(ce_iterator, iterator, 0 TSRMLS_CC);
if (inc_refcount) {
- iterator->refcount++;
+ Z_ADDREF_P(iterator);
}
intern->iterators[0].zobject = iterator;
intern->iterators[0].ce = ce_iterator;
@@ -1034,7 +1034,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
if (inc_refcount) {
- zobject->refcount++;
+ Z_ADDREF_P(zobject);
}
intern->inner.zobject = zobject;
intern->inner.ce = dit_type == DIT_IteratorIterator ? ce : Z_OBJCE_P(zobject);
@@ -1125,7 +1125,7 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T
if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
intern->current.data = *data;
- intern->current.data->refcount++;
+ Z_ADDREF_P(intern->current.data);
if (intern->inner.iterator->funcs->get_current_key) {
intern->current.key_type = intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.str_key, &intern->current.str_key_len, &intern->current.int_key TSRMLS_CC);
} else {
@@ -2058,7 +2058,7 @@ SPL_METHOD(CachingIterator, offsetSet)
return;
}
- value->refcount++;
+ Z_ADDREF_P(value);
zend_symtable_update(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, &value, sizeof(value), NULL);
}
/* }}} */
@@ -2502,7 +2502,7 @@ int spl_append_it_next_iterator(spl_dual_it_object *intern TSRMLS_DC) /* {{{*/
zval **it;
intern->u.append.iterator->funcs->get_current_data(intern->u.append.iterator, &it TSRMLS_CC);
- (*it)->refcount++;
+ Z_ADDREF_PP(it);
intern->inner.zobject = *it;
intern->inner.ce = Z_OBJCE_PP(it);
intern->inner.object = zend_object_store_get_object(*it TSRMLS_CC);
@@ -2700,7 +2700,7 @@ static int spl_iterator_to_array_apply(zend_object_iterator *iter, void *puser T
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
- (*data)->refcount++;
+ Z_ADDREF_PP(data);
switch(key_type) {
case HASH_KEY_IS_STRING:
add_assoc_zval_ex(return_value, str_key, str_key_len, *data);
@@ -2711,7 +2711,7 @@ static int spl_iterator_to_array_apply(zend_object_iterator *iter, void *puser T
break;
}
} else {
- (*data)->refcount++;
+ Z_ADDREF_PP(data);
add_next_index_zval(return_value, *data);
}
return ZEND_HASH_APPLY_KEEP;
@@ -2726,7 +2726,7 @@ static int spl_iterator_to_values_apply(zend_object_iterator *iter, void *puser
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
- (*data)->refcount++;
+ Z_ADDREF_PP(data);
add_next_index_zval(return_value, *data);
return ZEND_HASH_APPLY_KEEP;
}
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 1dd4c5c859..eeaac42bb8 100755
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -138,7 +138,7 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC
}
#endif
- obj->refcount++;
+ Z_ADDREF_P(obj);
} /* }}} */
/* {{{ proto void SplObjectStorage::attach($obj)