1 /* 2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved. 3 ** Distributed under the terms of the Haiku License. 4 */ 5 6 #include <wchar_private.h> 7 8 9 wchar_t* 10 __wcsstr(const wchar_t* haystack, const wchar_t* needleIn) 11 { 12 if (*needleIn == L'\0') 13 return (wchar_t*)haystack; 14 15 for (; *haystack != L'\0'; ++haystack) { 16 const wchar_t* needle = needleIn; 17 const wchar_t* haystackPointer = haystack; 18 while (*needle == *haystackPointer++ && *needle != 0) 19 ++needle; 20 if (*needle == L'\0') 21 return (wchar_t*)haystack; 22 } 23 24 return NULL; 25 } 26 27 28 B_DEFINE_WEAK_ALIAS(__wcsstr, wcsstr); 29 B_DEFINE_WEAK_ALIAS(__wcsstr, wcswcs); 30