summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2005-03-23 21:05:56 +0000
committerAndrei Zmievski <andrei@php.net>2005-03-23 21:05:56 +0000
commit992c28db75476ab6833ac074891b75b3393e215c (patch)
tree6dd0daa6c686b939c9e9b4c4face7d5a0fcbe274
parent2283e471f8bb1c8009dd310361c44e38fcbd2bc0 (diff)
downloadphp-git-992c28db75476ab6833ac074891b75b3393e215c.tar.gz
Consolidate: call _get_zval_ptr_var() for IS_VAR case in
_get_zval_ptr().
-rw-r--r--Zend/zend_execute.c102
1 files changed, 36 insertions, 66 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 4676b317d4..624c341f1c 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -157,6 +157,41 @@ static inline void zend_get_cv_address(zend_compiled_variable *cv, zval ***ptr,
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 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *
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 @@ static inline zval *_get_zval_ptr_tmp(znode *node, temp_variable *Ts, zend_free_
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);