diff options
Diffstat (limited to '')
-rw-r--r-- | src/wchar/wcschr.c | 15 |
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; } |