com php-src: Save one type checking if the type is already string: Zend/zend_API.c Zend/zend_builtin_functions.c

From: Date: Tue, 13 May 2014 06:05:28 +0000
Subject: com php-src: Save one type checking if the type is already string: Zend/zend_API.c Zend/zend_builtin_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78305@lists.php.net to get a copy of this message
Commit: 075a6ced0a3cd91014ab28272a120eca660e31fa Author: Xinchen Hui <laruence@php.net> Tue, 13 May 2014 14:05:28 +0800 Parents: 7080131e7134425b828921eb8e36cb043e4c39b1 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=075a6ced0a3cd91014ab28272a120eca660e31fa Log: Save one type checking if the type is already string Changed paths: M Zend/zend_API.c M Zend/zend_builtin_functions.c Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 6ef4c0b..f1e9614 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -480,12 +480,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } /* break omitted intentionally */ - case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(arg); + case IS_STRING: if (UNEXPECTED(Z_ISREF_P(arg))) { /* it's dangerous to return pointers to string buffer of referenced variable, because it can @@ -527,12 +527,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } /* break omitted intentionally */ - case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(arg); + case IS_STRING: if (UNEXPECTED(Z_ISREF_P(arg))) { /* it's dangerous to return pointers to string buffer of referenced variable, because it can diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index bc998ab..d8b8287 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -405,7 +405,6 @@ ZEND_FUNCTION(func_num_args) } /* }}} */ - /* {{{ proto mixed func_get_arg(int arg_num) Get the $arg_num'th argument that was passed to the function */ ZEND_FUNCTION(func_get_arg) @@ -443,7 +442,6 @@ ZEND_FUNCTION(func_get_arg) } /* }}} */ - /* {{{ proto array func_get_args() Get an array of the arguments that were passed to the function */ ZEND_FUNCTION(func_get_args) @@ -478,19 +476,17 @@ ZEND_FUNCTION(func_get_args) } /* }}} */ - /* {{{ proto int strlen(string str) Get string length */ ZEND_FUNCTION(strlen) { - char *s1; - int s1_len; + zend_string *s; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s1, &s1_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s) == FAILURE) { return; } - RETVAL_LONG(s1_len); + RETVAL_LONG(s->len); } /* }}} */

« previous php.cvs (#78305) next »