mirror of
https://github.com/php/php-src.git
synced 2024-11-27 20:03:40 +08:00
Get rid of more ZVAL_ZVAL() macros
This commit is contained in:
parent
8e10e8f921
commit
1c754f0b71
@ -459,7 +459,8 @@ ZEND_FUNCTION(func_get_arg)
|
||||
} else {
|
||||
arg = ZEND_CALL_ARG(ex, requested_offset + 1);
|
||||
}
|
||||
RETURN_ZVAL(arg, 1, 0);
|
||||
ZVAL_DEREF(arg);
|
||||
ZVAL_COPY(return_value, arg);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -819,7 +819,10 @@ ZEND_METHOD(Generator, current)
|
||||
|
||||
root = zend_generator_get_current(generator);
|
||||
if (Z_TYPE(root->value) != IS_UNDEF) {
|
||||
RETURN_ZVAL(&root->value, 1, 0);
|
||||
zval *value = &root->value;
|
||||
|
||||
ZVAL_DEREF(value);
|
||||
ZVAL_COPY(return_value, value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -840,7 +843,10 @@ ZEND_METHOD(Generator, key)
|
||||
|
||||
root = zend_generator_get_current(generator);
|
||||
if (Z_TYPE(root->key) != IS_UNDEF) {
|
||||
RETURN_ZVAL(&root->key, 1, 0);
|
||||
zval *key = &root->key;
|
||||
|
||||
ZVAL_DEREF(key);
|
||||
ZVAL_COPY(return_value, key);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -894,7 +900,10 @@ ZEND_METHOD(Generator, send)
|
||||
|
||||
root = zend_generator_get_current(generator);
|
||||
if (Z_TYPE(root->value) != IS_UNDEF) {
|
||||
RETURN_ZVAL(&root->value, 1, 0);
|
||||
zval *value = &root->value;
|
||||
|
||||
ZVAL_DEREF(value);
|
||||
ZVAL_COPY(return_value, value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -925,7 +934,10 @@ ZEND_METHOD(Generator, throw)
|
||||
|
||||
root = zend_generator_get_current(generator);
|
||||
if (Z_TYPE(root->value) != IS_UNDEF) {
|
||||
RETURN_ZVAL(&root->value, 1, 0);
|
||||
zval *value = &root->value;
|
||||
|
||||
ZVAL_DEREF(value);
|
||||
ZVAL_COPY(return_value, value);
|
||||
}
|
||||
} else {
|
||||
/* If the generator is already closed throw the exception in the
|
||||
@ -1023,7 +1035,10 @@ static void zend_generator_iterator_get_key(zend_object_iterator *iterator, zval
|
||||
root = zend_generator_get_current(generator);
|
||||
|
||||
if (Z_TYPE(root->key) != IS_UNDEF) {
|
||||
ZVAL_ZVAL(key, &root->key, 1, 0);
|
||||
zval *zv = &root->key;
|
||||
|
||||
ZVAL_DEREF(zv);
|
||||
ZVAL_COPY(key, zv);
|
||||
} else {
|
||||
ZVAL_NULL(key);
|
||||
}
|
||||
|
@ -3075,7 +3075,8 @@ PHP_FUNCTION(date_modify)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3129,7 +3130,8 @@ PHP_FUNCTION(date_add)
|
||||
|
||||
php_date_add(object, interval, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3184,7 +3186,8 @@ PHP_FUNCTION(date_sub)
|
||||
|
||||
php_date_sub(object, interval, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3286,7 +3289,8 @@ PHP_FUNCTION(date_timezone_set)
|
||||
|
||||
php_date_timezone_set(object, timezone_object, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3369,7 +3373,8 @@ PHP_FUNCTION(date_time_set)
|
||||
|
||||
php_date_time_set(object, h, i, s, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3417,7 +3422,8 @@ PHP_FUNCTION(date_date_set)
|
||||
|
||||
php_date_date_set(object, y, m, d, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3469,7 +3475,8 @@ PHP_FUNCTION(date_isodate_set)
|
||||
|
||||
php_date_isodate_set(object, y, w, d, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3515,7 +3522,8 @@ PHP_FUNCTION(date_timestamp_set)
|
||||
|
||||
php_date_timestamp_set(object, timestamp, return_value);
|
||||
|
||||
ZVAL_COPY(return_value, object);
|
||||
Z_ADDREF_P(object);
|
||||
ZVAL_COPY_VALUE(return_value, object);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -289,7 +289,8 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
|
||||
INTLITERATOR_METHOD_FETCH_OBJECT;
|
||||
|
||||
zval *biter_zval = &ii->iterator->data;
|
||||
RETURN_ZVAL(biter_zval, 1, 0);
|
||||
ZVAL_DEREF(biter_zval);
|
||||
ZVAL_COPY(return_value, biter_zval);
|
||||
}
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(ainfo_parts_it_void, 0, 0, 0)
|
||||
|
@ -219,7 +219,8 @@ static PHP_METHOD(IntlIterator, current)
|
||||
INTLITERATOR_METHOD_FETCH_OBJECT;
|
||||
data = ii->iterator->funcs->get_current_data(ii->iterator);
|
||||
if (data) {
|
||||
RETURN_ZVAL(data, 1, 0);
|
||||
ZVAL_DEREF(data);
|
||||
ZVAL_COPY(return_value, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3965,14 +3965,13 @@ PHP_METHOD(Phar, getMetadata)
|
||||
|
||||
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
|
||||
if (phar_obj->archive->is_persistent) {
|
||||
zval ret;
|
||||
char *buf = estrndup((char *) Z_PTR(phar_obj->archive->metadata), phar_obj->archive->metadata_len);
|
||||
/* assume success, we would have failed before */
|
||||
phar_parse_metadata(&buf, &ret, phar_obj->archive->metadata_len);
|
||||
phar_parse_metadata(&buf, return_value, phar_obj->archive->metadata_len);
|
||||
efree(buf);
|
||||
RETURN_ZVAL(&ret, 0, 1);
|
||||
} else {
|
||||
ZVAL_COPY(return_value, &phar_obj->archive->metadata);
|
||||
}
|
||||
RETURN_ZVAL(&phar_obj->archive->metadata, 1, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -4622,14 +4621,13 @@ PHP_METHOD(PharFileInfo, getMetadata)
|
||||
|
||||
if (Z_TYPE(entry_obj->entry->metadata) != IS_UNDEF) {
|
||||
if (entry_obj->entry->is_persistent) {
|
||||
zval ret;
|
||||
char *buf = estrndup((char *) Z_PTR(entry_obj->entry->metadata), entry_obj->entry->metadata_len);
|
||||
/* assume success, we would have failed before */
|
||||
phar_parse_metadata(&buf, &ret, entry_obj->entry->metadata_len);
|
||||
phar_parse_metadata(&buf, return_value, entry_obj->entry->metadata_len);
|
||||
efree(buf);
|
||||
RETURN_ZVAL(&ret, 0, 1);
|
||||
} else {
|
||||
ZVAL_COPY(return_value, &entry_obj->entry->metadata);
|
||||
}
|
||||
RETURN_ZVAL(&entry_obj->entry->metadata, 1, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -3512,7 +3512,8 @@ ZEND_METHOD(reflection_function, getShortName)
|
||||
{
|
||||
RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
|
||||
}
|
||||
RETURN_ZVAL(name, 1, 0);
|
||||
ZVAL_DEREF(name);
|
||||
ZVAL_COPY(return_value, name);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3819,14 +3820,15 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
|
||||
prop = zend_std_get_static_property(ce, name, 1);
|
||||
if (!prop) {
|
||||
if (def_value) {
|
||||
RETURN_ZVAL(def_value, 1, 0);
|
||||
ZVAL_COPY(return_value, def_value);
|
||||
} else {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0,
|
||||
"Class %s does not have a property named %s", ce->name->val, name->val);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
RETURN_ZVAL(prop, 1, 0);
|
||||
ZVAL_DEREF(prop);
|
||||
ZVAL_COPY(return_value, prop);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -5138,7 +5140,8 @@ ZEND_METHOD(reflection_class, getShortName)
|
||||
{
|
||||
RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
|
||||
}
|
||||
RETURN_ZVAL(name, 1, 0);
|
||||
ZVAL_DEREF(name);
|
||||
ZVAL_COPY(return_value, name);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -2743,7 +2743,8 @@ static zend_bool early_find_sid_in(zval *dest, int where, php_session_rfc1867_pr
|
||||
if ((ppid = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[where]), PS(session_name), progress->sname_len))
|
||||
&& Z_TYPE_P(ppid) == IS_STRING) {
|
||||
zval_dtor(dest);
|
||||
ZVAL_ZVAL(dest, ppid, 1, 0);
|
||||
ZVAL_DEREF(ppid);
|
||||
ZVAL_COPY(dest, ppid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ PHP_METHOD(ce_SimpleXMLIterator, valid)
|
||||
PHP_METHOD(ce_SimpleXMLIterator, current)
|
||||
{
|
||||
php_sxe_object *sxe = Z_SXEOBJ_P(getThis());
|
||||
zval *data;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@ -80,7 +81,9 @@ PHP_METHOD(ce_SimpleXMLIterator, current)
|
||||
return; /* return NULL */
|
||||
}
|
||||
|
||||
RETURN_ZVAL(&sxe->iter.data, 1, 0);
|
||||
data = &sxe->iter.data;
|
||||
ZVAL_DEREF(data);
|
||||
ZVAL_COPY(return_value, data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -158,6 +161,7 @@ PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
|
||||
PHP_METHOD(ce_SimpleXMLIterator, getChildren)
|
||||
{
|
||||
php_sxe_object *sxe = Z_SXEOBJ_P(getThis());
|
||||
zval *data;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@ -166,7 +170,10 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
|
||||
if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
|
||||
return; /* return NULL */
|
||||
}
|
||||
RETURN_ZVAL(&sxe->iter.data, 1, 0);
|
||||
|
||||
data = &sxe->iter.data;
|
||||
ZVAL_DEREF(data);
|
||||
ZVAL_COPY(return_value, data);
|
||||
}
|
||||
|
||||
/* {{{ arginfo */
|
||||
|
@ -821,7 +821,8 @@ PHP_FUNCTION(end)
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
}
|
||||
|
||||
RETURN_ZVAL(entry, 1, 0);
|
||||
ZVAL_DEREF(entry);
|
||||
ZVAL_COPY(return_value, entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -854,7 +855,8 @@ PHP_FUNCTION(prev)
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
}
|
||||
|
||||
RETURN_ZVAL(entry, 1, 0);
|
||||
ZVAL_DEREF(entry);
|
||||
ZVAL_COPY(return_value, entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -887,7 +889,8 @@ PHP_FUNCTION(next)
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
}
|
||||
|
||||
RETURN_ZVAL(entry, 1, 0);
|
||||
ZVAL_DEREF(entry);
|
||||
ZVAL_COPY(return_value, entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -920,7 +923,8 @@ PHP_FUNCTION(reset)
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
}
|
||||
|
||||
RETURN_ZVAL(entry, 1, 0);
|
||||
ZVAL_DEREF(entry);
|
||||
ZVAL_COPY(return_value, entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -950,7 +954,8 @@ PHP_FUNCTION(current)
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
}
|
||||
|
||||
RETURN_ZVAL(entry, 1, 0);
|
||||
ZVAL_DEREF(entry);
|
||||
ZVAL_COPY(return_value, entry);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -996,7 +1001,8 @@ PHP_FUNCTION(min)
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 0)) != NULL) {
|
||||
RETVAL_ZVAL(result, 1, 0);
|
||||
ZVAL_DEREF(result);
|
||||
ZVAL_COPY(return_value, result);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
|
||||
RETVAL_FALSE;
|
||||
@ -1016,7 +1022,8 @@ PHP_FUNCTION(min)
|
||||
}
|
||||
}
|
||||
|
||||
RETVAL_ZVAL(min, 1, 0);
|
||||
ZVAL_DEREF(min);
|
||||
ZVAL_COPY(return_value, min);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -1043,7 +1050,8 @@ PHP_FUNCTION(max)
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 1)) != NULL) {
|
||||
RETVAL_ZVAL(result, 1, 0);
|
||||
ZVAL_DEREF(result);
|
||||
ZVAL_COPY(return_value, result);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
|
||||
RETVAL_FALSE;
|
||||
@ -1063,7 +1071,8 @@ PHP_FUNCTION(max)
|
||||
}
|
||||
}
|
||||
|
||||
RETVAL_ZVAL(max, 1, 0);
|
||||
ZVAL_DEREF(max);
|
||||
ZVAL_COPY(return_value, max);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -343,7 +343,7 @@ PHP_FUNCTION(assert_options)
|
||||
|
||||
case ASSERT_CALLBACK:
|
||||
if (Z_TYPE(ASSERTG(callback)) != IS_UNDEF) {
|
||||
RETVAL_ZVAL(&ASSERTG(callback), 1, 0);
|
||||
ZVAL_COPY(return_value, &ASSERTG(callback));
|
||||
} else if (ASSERTG(cb)) {
|
||||
RETVAL_STRING(ASSERTG(cb));
|
||||
} else {
|
||||
|
@ -955,7 +955,7 @@ PHP_FUNCTION(stream_context_get_options)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_ZVAL(&context->options, 1, 0);
|
||||
ZVAL_COPY(return_value, &context->options);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -1739,7 +1739,8 @@ PHP_FUNCTION(pathinfo)
|
||||
} else {
|
||||
zval *element;
|
||||
if ((element = zend_hash_get_current_data(Z_ARRVAL(tmp))) != NULL) {
|
||||
RETVAL_ZVAL(element, 1, 0);
|
||||
ZVAL_DEREF(element);
|
||||
ZVAL_COPY(return_value, element);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(return_value);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ PHP_FUNCTION(msg_get_queue)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
RETVAL_ZVAL(zend_list_insert(mq, le_sysvmsg), 0, 0);
|
||||
ZVAL_COPY_VALUE(return_value, zend_list_insert(mq, le_sysvmsg));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user