diff options
author | Andrea Faulds <ajf@ajf.me> | 2014-08-27 01:53:26 +0100 |
---|---|---|
committer | Andrea Faulds <ajf@ajf.me> | 2014-08-27 01:53:26 +0100 |
commit | 17c5e82816558edddc623d6d9c401535096f29be (patch) | |
tree | 04e666bc96f0964e1adb9cb7dcf90f0c332c2d19 /Zend/zend_closures.c | |
parent | 342265badb7247ed088e409922b570b191ccf188 (diff) | |
parent | 1984a49b71b1bb88c6b408bee2ef99b79f2910f5 (diff) | |
download | php-git-17c5e82816558edddc623d6d9c401535096f29be.tar.gz |
Merge branch 'master' into Closure_apply
Diffstat (limited to 'Zend/zend_closures.c')
-rw-r--r-- | Zend/zend_closures.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 49543251db..c0df245c17 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -61,7 +61,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ efree(arguments); /* destruct the function also, then - we have allocated it in get_method */ - STR_RELEASE(func->internal_function.function_name); + zend_string_release(func->internal_function.function_name); efree(func); } /* }}} */ @@ -146,15 +146,14 @@ ZEND_METHOD(Closure, bind) ce = NULL; } else { zend_string *class_name = zval_get_string(scope_arg); - if ((class_name->len == sizeof("static") - 1) && - (memcmp("static", class_name->val, sizeof("static") - 1) == 0)) { + if (zend_string_equals_literal(class_name, "static")) { ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", class_name->val); - STR_RELEASE(class_name); + zend_string_release(class_name); RETURN_NULL(); } - STR_RELEASE(class_name); + zend_string_release(class_name); } } else { /* scope argument not given; do not change the scope by default */ ce = closure->func.common.scope; @@ -188,7 +187,7 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object TSRML invoke->internal_function.handler = ZEND_MN(Closure___invoke); invoke->internal_function.module = 0; invoke->internal_function.scope = zend_ce_closure; - invoke->internal_function.function_name = STR_INIT(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0); + invoke->internal_function.function_name = zend_string_init(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0); return invoke; } /* }}} */ @@ -211,15 +210,13 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string { zend_string *lc_name; - lc_name = STR_ALLOC(method->len, 0); + lc_name = zend_string_alloc(method->len, 0); zend_str_tolower_copy(lc_name->val, method->val, method->len); - if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && - memcmp(lc_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 - ) { - STR_FREE(lc_name); + if (zend_string_equals_literal(method, ZEND_INVOKE_FUNC_NAME)) { + zend_string_free(lc_name); return zend_get_closure_invoke_method(*object TSRMLS_CC); } - STR_FREE(lc_name); + zend_string_free(lc_name); return std_object_handlers.get_method(object, method, key TSRMLS_CC); } /* }}} */ @@ -363,7 +360,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_ } if (arg_info) { - zend_uint i, required = closure->func.common.required_num_args; + uint32_t i, required = closure->func.common.required_num_args; array_init(&val); @@ -381,7 +378,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_ } ZVAL_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>")); zend_hash_update(Z_ARRVAL(val), name, &info); - STR_RELEASE(name); + zend_string_release(name); arg_info++; } zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val); |