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:43:46 +00:00
parent b0a4aa7e3b
commit e6848d51c2

View File

@ -231,6 +231,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) {