summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2008-07-21 18:47:02 +0000
committerScott MacVicar <scottmac@php.net>2008-07-21 18:47:02 +0000
commite19f52047cb8b6683cce156a5e44d0fdac27dcb4 (patch)
treecf44b5dbc24fb2029da06ecf23830d797b56217c
parent86a493f43549de38dda15f6f4f4cb649cd57de01 (diff)
downloadphp-git-e19f52047cb8b6683cce156a5e44d0fdac27dcb4.tar.gz
Optimisation for zend_memnstr when the needle is only a single character. (Patch by Michal Dziemianko - GSoC08)
-rw-r--r--Zend/zend_operators.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index fb19c0319d..658e16c71d 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -220,6 +220,10 @@ zend_memnstr(char *haystack, char *needle, int needle_len, char *end)
char *p = haystack;
char ne = needle[needle_len-1];
+ if (needle_len == 1) {
+ return (char *)memchr(p, *needle, (end-p));
+ }
+
end -= needle_len;
while (p <= end) {