From ff6b4ad8c78d27fdb6fe6fb2f17dd3b25c345368 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Sat, 17 Jan 2015 08:30:40 -0800 Subject: [PATCH] FAST ZPP for strtok() and nl2br() Looking at some template-driven code that calls these hundreds of times per request --- ext/standard/string.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ext/standard/string.c b/ext/standard/string.c index 44ff94fff3..f6096d1697 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1287,9 +1287,17 @@ PHP_FUNCTION(strtok) char *pe; size_t skipped = 0; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &str, &tok) == FAILURE) { 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) { tok = str; @@ -4322,9 +4330,17 @@ PHP_FUNCTION(nl2br) zend_bool is_xhtml = 1; zend_string *result; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &str, &is_xhtml) == FAILURE) { 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; end = str->val + str->len; -- 2.40.0