zend_hash_real_init(Z_ARRVAL_P(return_value), 0);
/* add value elements */
- if (Z_ISREF_P(entry)) {
- ZVAL_DUP(&tmp, Z_REFVAL_P(entry));
- entry = &tmp;
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
- } else {
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
- }
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry);
zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry);
* Throws an exception into the generator */
ZEND_METHOD(Generator, throw)
{
- zval *exception, exception_copy;
+ zval *exception;
zend_generator *generator;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(exception)
ZEND_PARSE_PARAMETERS_END();
- ZVAL_DUP(&exception_copy, exception);
+ Z_TRY_ADDREF_P(exception);
generator = (zend_generator *) Z_OBJ_P(getThis());
if (generator->execute_data) {
zend_generator *root = zend_generator_get_current(generator);
- zend_generator_throw_exception(root, &exception_copy);
+ zend_generator_throw_exception(root, exception);
zend_generator_resume(generator);
} else {
/* If the generator is already closed throw the exception in the
* current context */
- zend_throw_exception_object(&exception_copy);
+ zend_throw_exception_object(exception);
}
}
/* }}} */
if ((value = _default_load_entry(object, name, name_len)) == NULL) {
RETURN_FALSE;
}
- ZVAL_DUP(return_value, value);
+ ZVAL_COPY(return_value, value);
}
/* }}} */
-#ifdef ilia_0
-static void _default_lookup_entry(zval *object, char *name, int name_len, zval **return_value) /* {{{ */
-{
- zval **value;
-
- if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
- *return_value = NULL;
- } else {
- *return_value = *value;
- }
-}
-/* }}} */
-#endif
-
static zend_function *_copy_function(zend_function *fptr) /* {{{ */
{
if (fptr
zval zv;
smart_str_appends(str, " = ");
- ZVAL_DUP(&zv, RT_CONSTANT(precv, precv->op2));
+ ZVAL_COPY(&zv, RT_CONSTANT(precv, precv->op2));
if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) {
zval_ptr_dtor(&zv);
return;
return;
}
- ZVAL_DUP(return_value, RT_CONSTANT(precv, precv->op2));
+ ZVAL_COPY(return_value, RT_CONSTANT(precv, precv->op2));
if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
zval_update_constant_ex(return_value, param->fptr->common.scope);
}