mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use better data structures (incomplete)
This commit is contained in:
parent
f0168baecf
commit
ad1838d248
5 changed files with 13 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -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 = '"';
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue