cvs: ZendEngine2 / zend_execute.c

From: Date: Wed, 23 Mar 2005 21:06:00 +0000
Subject: cvs: ZendEngine2 / zend_execute.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3526@lists.php.net to get a copy of this message
andrei Wed Mar 23 16:06:00 2005 EDT Modified files: /ZendEngine2 zend_execute.c Log: Consolidate: call _get_zval_ptr_var() for IS_VAR case in _get_zval_ptr(). http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.692&r2=1.693&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.692 ZendEngine2/zend_execute.c:1.693 --- ZendEngine2/zend_execute.c:1.692 Fri Jan 21 21:29:18 2005 +++ ZendEngine2/zend_execute.c Wed Mar 23 16:05:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.692 2005/01/22 02:29:18 andi Exp $ */ +/* $Id: zend_execute.c,v 1.693 2005/03/23 21:05:56 andrei Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -157,6 +157,41 @@ zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr); } +static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +{ + if (T(node->u.var).var.ptr) { + PZVAL_UNLOCK(T(node->u.var).var.ptr, should_free); + return T(node->u.var).var.ptr; + } else { + temp_variable *T = &T(node->u.var); + zval *str = T->str_offset.str; + zval *ptr; + + /* string offset */ + ALLOC_ZVAL(ptr); + T->str_offset.ptr = ptr; + should_free->var = ptr; + + if (T->str_offset.str->type != IS_STRING + || ((int)T->str_offset.offset<0) + || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { + zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); + ptr->value.str.val = STR_EMPTY_ALLOC(); + ptr->value.str.len = 0; + } else { + char c = str->value.str.val[T->str_offset.offset]; + + ptr->value.str.val = estrndup(&c, 1); + ptr->value.str.len = 1; + } + PZVAL_UNLOCK_FREE(str); + ptr->refcount=1; + ptr->is_ref=1; + ptr->type = IS_STRING; + return ptr; + } +} + static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { /* should_free->is_var = 0; */ @@ -170,37 +205,7 @@ return &T(node->u.var).tmp_var; break; case IS_VAR: - if (T(node->u.var).var.ptr) { - PZVAL_UNLOCK(T(node->u.var).var.ptr, should_free); - return T(node->u.var).var.ptr; - } else { - temp_variable *T = &T(node->u.var); - zval *str = T->str_offset.str; - zval *ptr; - - /* string offset */ - ALLOC_ZVAL(ptr); - T->str_offset.ptr = ptr; - should_free->var = ptr; - - if (T->str_offset.str->type != IS_STRING - || ((int)T->str_offset.offset<0) - || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { - zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); - ptr->value.str.val = STR_EMPTY_ALLOC(); - ptr->value.str.len = 0; - } else { - char c = str->value.str.val[T->str_offset.offset]; - - ptr->value.str.val = estrndup(&c, 1); - ptr->value.str.len = 1; - } - PZVAL_UNLOCK_FREE(str); - ptr->refcount=1; - ptr->is_ref=1; - ptr->type = IS_STRING; - return ptr; - } + return _get_zval_ptr_var(node, Ts, should_free TSRMLS_CC); break; case IS_UNUSED: should_free->var = 0; @@ -290,41 +295,6 @@ return should_free->var = &T(node->u.var).tmp_var; } -static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) -{ - if (T(node->u.var).var.ptr) { - PZVAL_UNLOCK(T(node->u.var).var.ptr, should_free); - return T(node->u.var).var.ptr; - } else { - temp_variable *T = &T(node->u.var); - zval *str = T->str_offset.str; - zval *ptr; - - /* string offset */ - ALLOC_ZVAL(ptr); - T->str_offset.ptr = ptr; - should_free->var = ptr; - - if (T->str_offset.str->type != IS_STRING - || ((int)T->str_offset.offset<0) - || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { - zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); - ptr->value.str.val = STR_EMPTY_ALLOC(); - ptr->value.str.len = 0; - } else { - char c = str->value.str.val[T->str_offset.offset]; - - ptr->value.str.val = estrndup(&c, 1); - ptr->value.str.len = 1; - } - PZVAL_UNLOCK_FREE(str); - ptr->refcount=1; - ptr->is_ref=1; - ptr->type = IS_STRING; - return ptr; - } -} - static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { zval ***ptr = &CV_OF(node->u.var);

« previous php.zend-engine.cvs (#3526) next »