aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/string/strstr.c2
-rw-r--r--src/wchar/wcsstr.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/string/strstr.c b/src/string/strstr.c
index a2c31f6..f396570 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -37,6 +37,8 @@
*/
char* (strstr)(const char* haystack, const char* needle)
{
+ if (*needle && !(needle[1]))
+ return (strchr)(haystack, *needle);
return (memmem)(haystack, strlen(haystack), needle, strlen(needle));
}
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);
}