com php-src: Use better data structures (incomplete): ext/spl/spl_array.c ext/spl/spl_directory.c ext/spl /spl_engine.c ext/spl/spl_fixedarray.c
ext/spl/spl _functions.c
| From: | Dmitry Stogov | Date: | Sun, 16 Feb 2014 14:27:31 +0000 |
| Subject: | com php-src: Use better data structures (incomplete): ext/spl/spl_array.c ext/spl/spl_directory.c ext/spl /spl_engine.c ext/spl/spl_fixedarray.c ext/spl/spl _functions.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78084@lists.php.net to get a copy of this message | ||
Commit: ad1838d2483c3a44c77a2d483a5cf27ffeb63e45
Author: Xinchen Hui <laruence@gmail.com> Sun, 16 Feb 2014 22:27:31 +0800
Parents: f0168baecfb27e104e46fe914e5b5b6507ba8214
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad1838d2483c3a44c77a2d483a5cf27ffeb63e45
Log:
Use better data structures (incomplete)
Changed paths:
M ext/spl/spl_array.c
M ext/spl/spl_directory.c
M ext/spl/spl_engine.c
M ext/spl/spl_fixedarray.c
M ext/spl/spl_functions.c
Diff:
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 5ef386b..903ca78 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -149,7 +149,7 @@ SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */
/* }}} */
/* {{{ spl_array_object_free_storage */
-static void spl_array_object_free_storage(void *object TSRMLS_DC)
+static void spl_array_object_free_storage(zend_object *object TSRMLS_DC)
{
spl_array_object *intern = (spl_array_object *)object;
@@ -1297,7 +1297,7 @@ SPL_METHOD(Array, getIterator)
ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0 TSRMLS_CC));
Z_SET_REFCOUNT_P(return_value, 1);
- Z_SET_ISREF_P(return_value);
+ //!!!PZ_SET_ISREF_P(return_value);
}
/* }}} */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 1233436..f2093d9 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -294,7 +294,8 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
}
if (!ZVAL_IS_UNDEF(&intern->u.file.zcontext)) {
- zend_list_addref(Z_RESVAL_P(intern->u.file.zcontext));
+ //zend_list_addref(Z_RES_VAL(intern->u.file.zcontext));
+ Z_ADDREF_P(&intern->u.file.zcontext);
}
if (intern->file_name_len > 1 && IS_SLASH_AT(intern->file_name,
intern->file_name_len-1)) {
@@ -307,8 +308,10 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int
use_inclu
intern->u.file.open_mode = estrndup(intern->u.file.open_mode,
intern->u.file.open_mode_len);
/* 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));
+ ZVAL_RES(&intern->u.file.zresource, intern->u.file.stream->res);
+ /*!!! TODO: maybe bug?
Z_SET_REFCOUNT(intern->u.file.zresource, 1);
+ */
intern->u.file.delimiter = ',';
intern->u.file.enclosure = '"';
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 1787f28..3d12b04 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -36,7 +36,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
object_init_ex(object, pce);
Z_SET_REFCOUNT_P(object, 1);
- Z_SET_ISREF_P(object); /* check if this can be hold always */
+ // !!!PZ_SET_ISREF_P(object); /* check if this can be hold always */
}
/* }}} */
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 3c35dc7..075df9b 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -601,7 +601,7 @@ SPL_METHOD(SplFixedArray, __wakeup)
spl_fixedarray_init(intern->array, size TSRMLS_CC);
for (zend_hash_internal_pointer_reset_ex(intern_ht, &ptr); (data =
zend_hash_get_current_data_ex(intern_ht, &ptr)) != NULL; zend_hash_move_forward_ex(intern_ht,
&ptr)) {
- Z_ADDREF_PP(data);
+ Z_ADDREF_P(data);
ZVAL_COPY_VALUE(&intern->array->elements[index++], data);
}
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 6b5a612..e3cf132 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -77,16 +77,16 @@ void spl_register_property( zend_class_entry * class_entry, char *prop_name, int
/* }}} */
/* {{{ spl_add_class_name */
-void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
+void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags TSRMLS_DC)
{
if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0
&& !(pce->ce_flags & ce_flags))) {
zval *tmp;
if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
- MAKE_STD_ZVAL(tmp);
+ zval t;
STR_ADDREF(pce->name);
- ZVAL_STR(tmp, pce->name);
- zend_hash_add(Z_ARRVAL_P(list), pce->name, tmp);
+ ZVAL_STR(&t, pce->name);
+ zend_hash_add(Z_ARRVAL_P(list), pce->name, &t);
}
}
}