diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-02 20:49:08 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-02 20:49:08 +0200 |
commit | f9e52c4acbd8f53da1b083770c6aab9c67cb0368 (patch) | |
tree | 755cb04726fbf6f44b42d94844fd78be6940dd7c /src/wchar | |
parent | add memcasecmp and wmemcasecmp (diff) | |
download | slibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.gz slibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.bz2 slibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.xz |
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/wchar/wcsspn.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/wchar/wcsspn.c b/src/wchar/wcsspn.c index 239b863..63dc60b 100644 --- a/src/wchar/wcsspn.c +++ b/src/wchar/wcsspn.c @@ -53,12 +53,16 @@ size_t wcsspn(const wchar_t* string, const wchar_t* skipset) */ size_t wcscspn(const wchar_t* string, const wchar_t* stopset) { - size_t end = wcslen(string); - wchar_t* p; + size_t i, end = wcslen(string); + wchar_t* s; wchar_t c; while ((c = *stopset++)) - if (p = wcsnchr(string, c, end), p != NULL) - end = (size_t)(p - string); + for (i = 0, s = string; *s && (i < end); i++, s++) + if (*s == c) + { + end = (size_t)(s - string); + break; + } return end; } |