aboutsummaryrefslogtreecommitdiffstats
path: root/src/wchar/wcschr.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-01 06:03:04 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-01 06:03:04 +0200
commite2d52adc78d14ba3d2c6a6017798c704a2ffb4c5 (patch)
tree58e548d3badc94baa6eda95c783336e01e277d8c /src/wchar/wcschr.c
parentwcswcs is deprecated (diff)
downloadslibc-e2d52adc78d14ba3d2c6a6017798c704a2ffb4c5.tar.gz
slibc-e2d52adc78d14ba3d2c6a6017798c704a2ffb4c5.tar.bz2
slibc-e2d52adc78d14ba3d2c6a6017798c704a2ffb4c5.tar.xz
add strstr functions
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/wchar/wcschr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c
index e96a90a..493f0a7 100644
--- a/src/wchar/wcschr.c
+++ b/src/wchar/wcschr.c
@@ -95,10 +95,11 @@ wchar_t* wmemrchr(const wchar_t* segment, wchar_t c, size_t size)
*/
wchar_t* wcschr(const wchar_t* string, wchar_t c)
{
- while (; *string; string++)
+ for (;;)
if (*string == c)
return string;
- return NULL;
+ else if (!*string++)
+ return NULL;
}
@@ -119,10 +120,11 @@ wchar_t* wcschr(const wchar_t* string, wchar_t c)
*/
wchar_t* wcschrnul(const wchar_t* string, wchar_t c)
{
- while (; *string; string++)
+ for (;; string++)
if (*string == c)
return string;
- return string;
+ else if (!*string)
+ return string;
}
@@ -143,9 +145,10 @@ wchar_t* wcschrnul(const wchar_t* string, wchar_t c)
wchar_t* wcsrchr(const wchar_t* string, wchar_t c)
{
wchar_t* r = NULL;
- while (; *string; string++)
+ for (;;)
if (*string == c)
r = string;
- return r;
+ else if (!*string++)
+ return r;
}