aboutsummaryrefslogtreecommitdiffstats
path: root/src/wchar
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-13 22:01:11 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-13 22:01:11 +0100
commit3ebcc813dc643fc0853ebc159fa5b6e747258933 (patch)
tree448a287a5ed02ca8705538d71215431840b94816 /src/wchar
parentadd todos (diff)
downloadslibc-3ebcc813dc643fc0853ebc159fa5b6e747258933.tar.gz
slibc-3ebcc813dc643fc0853ebc159fa5b6e747258933.tar.bz2
slibc-3ebcc813dc643fc0853ebc159fa5b6e747258933.tar.xz
improve performance on strstr and wcsstr if the needle is one character wide
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/wchar')
-rw-r--r--src/wchar/wcsstr.c2
1 files changed, 2 insertions, 0 deletions
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);
}