com php-src: Use zend_str_equals more often: Zend/z end_compile.c

From: Date: Mon, 28 Jul 2014 20:07:11 +0000
Subject: com php-src: Use zend_str_equals more often: Zend/z end_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-80891@lists.php.net to get a copy of this message
Commit: 8c724c205d81b2477883c6c10f553b8fa9fc9f38 Author: Nikita Popov <nikic@php.net> Mon, 28 Jul 2014 22:07:11 +0200 Parents: 788905068580c03d3f3f8a324add93afb5a65703 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8c724c205d81b2477883c6c10f553b8fa9fc9f38 Log: Use zend_str_equals more often Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 8506a82..85f401f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3543,7 +3543,7 @@ static int zend_try_compile_cv(znode *result, zend_ast *ast TSRMLS_DC) { result->op_type = IS_CV; result->u.op.var = lookup_cv(CG(active_op_array), name TSRMLS_CC); - if (name->len == sizeof("this") - 1 && !memcmp(name->val, "this", sizeof("this") - 1)) { + if (zend_str_equals(name, "this")) { CG(active_op_array)->this_var = result->u.op.var; } return SUCCESS; @@ -3634,8 +3634,7 @@ static zend_bool is_this_fetch(zend_ast *ast) { } zval *name = zend_ast_get_zval(ast->child[0]); - return Z_TYPE_P(name) == IS_STRING && Z_STRLEN_P(name) == sizeof("this") - 1 - && !memcmp(Z_STRVAL_P(name), "this", sizeof("this") - 1); + return Z_TYPE_P(name) == IS_STRING && zend_str_equals(Z_STR_P(name), "this"); } zend_op *zend_compile_prop_common(znode *result, zend_ast *ast, int type TSRMLS_DC) { @@ -4353,11 +4352,7 @@ void zend_compile_method_call(znode *result, zend_ast *ast, int type TSRMLS_DC) } zend_bool zend_is_constructor(zend_string *name) { - char *lcname = zend_str_tolower_dup(name->val, name->len); - zend_bool is_ctor = name->len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1 && - !memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1); - efree(lcname); - return is_ctor; + return zend_str_equals_ci(name, ZEND_CONSTRUCTOR_FUNC_NAME); } void zend_compile_static_call(znode *result, zend_ast *ast, int type TSRMLS_DC) { @@ -5211,9 +5206,7 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) { if (EX_VAR_TO_NUM(var_node..u.op.var) != i) { zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter %s", name->val); - } else if (name->len == sizeof("this") - 1 - && !memcmp(name->val, "this", sizeof("this") - 1) - ) { + } else if (zend_str_equals(name, "this")) { if (op_array->scope && (op_array->fn_flags & ZEND_ACC_STATIC) == 0) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); }

« previous php.cvs (#80891) next »