1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Removed or simplified incorrect SEPARATE_*() macros usage.

This commit is contained in:
Dmitry Stogov
2015-09-29 11:17:43 +03:00
parent 617bef558b
commit 560e4fa393
16 changed files with 13 additions and 39 deletions

View File

@@ -506,7 +506,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
ZVAL_DEREF(arg);
while (1) {
if (*spec_walk == '/') {
SEPARATE_ZVAL(arg);
SEPARATE_ZVAL_NOREF(arg);
real_arg = arg;
} else if (*spec_walk == '!') {
check_null = 1;

View File

@@ -849,9 +849,7 @@ PHP_FUNCTION(mhash)
return;
}
SEPARATE_ZVAL(z_algorithm);
convert_to_long_ex(z_algorithm);
algorithm = Z_LVAL_P(z_algorithm);
algorithm = zval_get_long(z_algorithm);
/* need to convert the first parameter from int constant to string algorithm name */
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {

View File

@@ -68,7 +68,6 @@ PHP_FUNCTION( numfmt_format )
}
if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) {
SEPARATE_ZVAL_IF_NOT_REF(number);
convert_scalar_to_number(number );
}

View File

@@ -810,7 +810,7 @@ PHP_FUNCTION(grapheme_extract)
} else {
ZVAL_DEREF(next);
/* initialize next */
SEPARATE_ZVAL(next);
SEPARATE_ZVAL_NOREF(next);
zval_dtor(next);
ZVAL_LONG(next, lstart);
}

View File

@@ -332,7 +332,6 @@ PHP_FUNCTION( transliterator_transliterate )
int res;
if(Z_TYPE_P( arg1 ) != IS_STRING )
{
SEPARATE_ZVAL( arg1 );
convert_to_string( arg1 );
}
object = &tmp_object;

View File

@@ -730,7 +730,6 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
goto cleanup;
}
SEPARATE_ZVAL(attr);
convert_to_string_ex(attr);
ldap_attrs[i] = Z_STRVAL_P(attr);
}

View File

@@ -664,7 +664,6 @@ is_string:
}
} else if (Z_TYPE(retval) != IS_NULL) {
/* retval not string nor resource nor null; convert to string */
SEPARATE_ZVAL(&retval);
convert_to_string(&retval);
goto is_string;
} /* else is null; don't try anything */

View File

@@ -1040,11 +1040,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) {
if (Z_TYPE_P(user_signo) != IS_LONG) {
SEPARATE_ZVAL(user_signo);
convert_to_long_ex(user_signo);
}
signo = Z_LVAL_P(user_signo);
signo = zval_get_long(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
@@ -1105,11 +1101,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) {
if (Z_TYPE_P(user_signo) != IS_LONG) {
SEPARATE_ZVAL(user_signo);
convert_to_long_ex(user_signo);
}
signo = Z_LVAL_P(user_signo);
signo = zval_get_long(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));

View File

@@ -1446,12 +1446,10 @@ static int preg_replace_impl(zval *return_value, zval *regex, zval *replace, zva
int replace_count = 0, old_replace_count;
if (Z_TYPE_P(replace) != IS_ARRAY && (Z_TYPE_P(replace) != IS_OBJECT || !is_callable_replace)) {
SEPARATE_ZVAL(replace);
convert_to_string_ex(replace);
}
if (Z_TYPE_P(regex) != IS_ARRAY) {
SEPARATE_ZVAL(regex);
convert_to_string_ex(regex);
}

View File

@@ -376,10 +376,10 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
/* We need to manually convert to a pg native boolean value */
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL &&
((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) {
SEPARATE_ZVAL(&param->parameter);
const char *s = zend_is_true(&param->parameter) ? "t" : "f";
param->param_type = PDO_PARAM_STR;
convert_to_boolean(&param->parameter);
ZVAL_STRINGL(&param->parameter, Z_TYPE_P(&param->parameter) == IS_TRUE ? "t" : "f", 1);
zval_ptr_dtor(&param->parameter);
ZVAL_STRINGL(&param->parameter, s, 1);
}
}
return 1;

View File

@@ -1455,12 +1455,9 @@ static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive)
zend_fcall_info orig_array_walk_fci;
zend_fcall_info_cache orig_array_walk_fci_cache;
if (Z_ISREF_P(zv)) {
thash = Z_ARRVAL_P(Z_REFVAL_P(zv));
} else {
SEPARATE_ZVAL(zv);
thash = Z_ARRVAL_P(zv);
}
ZVAL_DEREF(zv);
SEPARATE_ARRAY(zv);
thash = Z_ARRVAL_P(zv);
if (thash->u.v.nApplyCount > 1) {
php_error_docref(NULL, E_WARNING, "recursion detected");
if (userdata) {

View File

@@ -420,7 +420,6 @@ php_formatted_print(zend_execute_data *execute_data, int use_array, int format_o
z_format = &args[format_offset];
array = &args[1 + format_offset];
if (Z_TYPE_P(array) != IS_ARRAY) {
SEPARATE_ZVAL(array);
convert_to_array(array);
}

View File

@@ -3973,7 +3973,6 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(search), search_entry) {
/* Make sure we're dealing with strings. */
ZVAL_DEREF(search_entry);
SEPARATE_ZVAL_NOREF(search_entry);
convert_to_string(search_entry);
if (Z_STRLEN_P(search_entry) == 0) {
if (Z_TYPE_P(replace) == IS_ARRAY) {

View File

@@ -153,7 +153,6 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params)
return NULL;
} else {
if (Z_TYPE_P(value) != IS_STRING) {
SEPARATE_ZVAL(value);
convert_to_string(value);
}
@@ -762,7 +761,6 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
php_error_docref(NULL, E_WARNING, "Invalid parameter array");
RETURN_FALSE;
}
SEPARATE_ZVAL(entry);
convert_to_string_ex(entry);
if (Z_REFCOUNTED_P(entry)) {
Z_ADDREF_P(entry);
@@ -850,7 +848,6 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
intern = Z_XSL_P(id);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) {
SEPARATE_ZVAL(entry);
convert_to_string_ex(entry);
ZVAL_LONG(&new_string ,1);
zend_hash_update(intern->registered_phpfunctions, Z_STR_P(entry), &new_string);

View File

@@ -649,7 +649,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
zend_hash_index_update(dest, num_key, src_entry);
}
} else {
SEPARATE_ZVAL(dest_entry);
SEPARATE_ARRAY(dest_entry);
php_autoglobal_merge(Z_ARRVAL_P(dest_entry), Z_ARRVAL_P(src_entry));
}
} ZEND_HASH_FOREACH_END();

View File

@@ -840,9 +840,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb)
#define STAT_PROP_ENTRY_EX(name, name2) \
if (NULL != (elem = zend_hash_str_find(Z_ARRVAL_P(array), #name, sizeof(#name)-1))) { \
SEPARATE_ZVAL(elem); \
convert_to_long(elem); \
ssb->sb.st_##name2 = Z_LVAL_P(elem); \
ssb->sb.st_##name2 = zval_get_long(elem); \
}
#define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name)