From 3ebcc813dc643fc0853ebc159fa5b6e747258933 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 13 Nov 2015 22:01:11 +0100 Subject: improve performance on strstr and wcsstr if the needle is one character wide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/wchar/wcsstr.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/wchar') diff --git a/src/wchar/wcsstr.c b/src/wchar/wcsstr.c index 36ae893..b0600e1 100644 --- a/src/wchar/wcsstr.c +++ b/src/wchar/wcsstr.c @@ -33,6 +33,8 @@ */ wchar_t* (wcswcs)(const wchar_t* haystack, const wchar_t* needle) { + if (*needle && !(needle[1])) + return (wcschr)(haystack, *needle); return (wcsstr)(haystack, needle); } -- cgit v1.2.3-70-g09d2