From df7ca608ce62dba76ab7c766bede2a3f9b68755e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 25 Apr 2014 00:56:15 +0400 Subject: Optimized constant lookup --- Zend/zend_builtin_functions.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Zend/zend_builtin_functions.c') diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 1d066deb41..32bd68e58e 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -729,16 +729,13 @@ repeat: Check whether a constant exists */ ZEND_FUNCTION(defined) { - char *name; - int name_len; - zval c; + zend_string *name; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) { return; } - if (zend_get_constant_ex(name, name_len, &c, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { - zval_dtor(&c); + if (zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -927,7 +924,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value /* this is necessary to make it able to work with default array * properties, returned to user */ - if (Z_CONSTANT(prop_copy)) { + if (Z_OPT_CONSTANT(prop_copy)) { zval_update_constant(&prop_copy, 0 TSRMLS_CC); } -- cgit v1.2.1