1
0
mirror of https://github.com/php/php-src.git synced 2026-04-06 23:53:30 +02:00

Save one type checking if the type is already string

This commit is contained in:
Xinchen Hui
2014-05-13 14:05:28 +08:00
parent 7080131e71
commit 075a6ced0a
2 changed files with 5 additions and 9 deletions

View File

@@ -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

View File

@@ -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);
}
/* }}} */