Browse Source

Save one type checking if the type is already string

pull/678/head
Xinchen Hui 12 years ago
parent
commit
075a6ced0a
  1. 4
      Zend/zend_API.c
  2. 10
      Zend/zend_builtin_functions.c

4
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

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

Loading…
Cancel
Save