FAST ZPP for strtok() and nl2br()

Looking at some template-driven code that calls these
hundreds of times per request
This commit is contained in:
Rasmus Lerdorf 2015-01-17 08:30:40 -08:00
parent f487e4c638
commit ff6b4ad8c7

View file

@ -1287,9 +1287,17 @@ PHP_FUNCTION(strtok)
char *pe; char *pe;
size_t skipped = 0; size_t skipped = 0;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &str, &tok) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &str, &tok) == FAILURE) {
return; return;
} }
#else
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
Z_PARAM_STR(tok)
ZEND_PARSE_PARAMETERS_END();
#endif
if (ZEND_NUM_ARGS() == 1) { if (ZEND_NUM_ARGS() == 1) {
tok = str; tok = str;
@ -4322,9 +4330,17 @@ PHP_FUNCTION(nl2br)
zend_bool is_xhtml = 1; zend_bool is_xhtml = 1;
zend_string *result; zend_string *result;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &str, &is_xhtml) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &str, &is_xhtml) == FAILURE) {
return; return;
} }
#else
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(is_xhtml)
ZEND_PARSE_PARAMETERS_END();
#endif
tmp = str->val; tmp = str->val;
end = str->val + str->len; end = str->val + str->len;