summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-04-03 15:26:23 +0400
committerDmitry Stogov <dmitry@zend.com>2014-04-03 15:26:23 +0400
commit76cc99fe60d1e446a0250b4d778f02bcdbd7fc09 (patch)
tree51b80d5b6c401bebee6c01d28423018a10edb232 /main/php_variables.c
parentd8099d0468426dbee59f540048376653535270ce (diff)
downloadphp-git-76cc99fe60d1e446a0250b4d778f02bcdbd7fc09.tar.gz
Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc)
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index 20bee7e8d9..4202db5aa2 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -49,7 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
assert(strval != NULL);
/* Prepare value */
- ZVAL_STR(&new_entry, STR_INIT(strval, str_len, 0));
+ ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0));
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
}
@@ -609,11 +609,9 @@ static inline void php_register_server_variables(TSRMLS_D)
/* store request init time */
{
zval request_time_float, request_time_long;
- Z_TYPE(request_time_float) = IS_DOUBLE;
- Z_DVAL(request_time_float) = sapi_get_request_time(TSRMLS_C);
+ ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C));
php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
- Z_TYPE(request_time_long) = IS_LONG;
- Z_LVAL(request_time_long) = zend_dval_to_lval(Z_DVAL(request_time_float));
+ ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float)));
php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}