Optimisation for zend_memnstr when the needle is only a single character. (Patch by Michal Dziemianko - GSoC08)

This commit is contained in:
Scott MacVicar 2008-07-21 18:47:02 +00:00
parent 86a493f435
commit e19f52047c

View File

@ -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) {