com php-src: FAST ZPP for strtok() and nl2br() Looking at some template-driven code that calls these hundreds of times per request:
ext/standard/string.c
| From: | Rasmus Lerdorf | Date: | Sat, 17 Jan 2015 16:30:40 +0000 |
| Subject: | com php-src: FAST ZPP for strtok() and nl2br() Looking at some template-driven code that calls these hundreds of times per request: ext/standard/string.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84142@lists.php.net to get a copy of this message | ||
Commit: ff6b4ad8c78d27fdb6fe6fb2f17dd3b25c345368
Author: Rasmus Lerdorf <rasmus@php.net> Sat, 17 Jan 2015 08:30:40 -0800
Parents: f487e4c638a63aa7b22530f72c2f3f77b9a01d11
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ff6b4ad8c78d27fdb6fe6fb2f17dd3b25c345368
Log:
FAST ZPP for strtok() and nl2br()
Looking at some template-driven code that calls these
hundreds of times per request
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 44ff94f..f6096d1 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;