From e0151fb795b8a6fac18622b5cb07d973bb1c74d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kinn=20Coelho=20Juli=C3=A3o?= Date: Wed, 11 Apr 2012 17:00:53 -0300 Subject: [PATCH] The code is correct. Just removing the nested if, because there is no need. --- main/php_variables.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/main/php_variables.c b/main/php_variables.c index 427966170c8f..78742b284a4e 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -472,10 +472,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]); Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp)); INIT_PZVAL(tmp); - if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { - if (Z_TYPE_P(tmp) == IS_STRING) { - efree(Z_STRVAL_P(tmp)); - } + if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE && Z_TYPE_P(tmp) == IS_STRING) { + efree(Z_STRVAL_P(tmp)); } } } else if (s && *s) { @@ -492,10 +490,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp)); INIT_PZVAL(tmp); count++; - if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { - if (Z_TYPE_P(tmp) == IS_STRING) { - efree(Z_STRVAL_P(tmp)); - } + if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE && Z_TYPE_P(tmp) == IS_STRING) { + efree(Z_STRVAL_P(tmp)); } if (space) { *space = '+';