summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/mbrtowc.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/libc/locale/mbrtowc.c b/lib/libc/locale/mbrtowc.c
index 2a61115..7e4d90e 100644
--- a/lib/libc/locale/mbrtowc.c
+++ b/lib/libc/locale/mbrtowc.c
@@ -45,12 +45,6 @@ mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
n = 1;
}
- if (*s == '\0') {
- if (pwc != NULL)
- *pwc = L'\0';
- return (0);
- }
-
if ((r = sgetrune(s, n, &e)) == _INVALID_RUNE) {
/*
* The design of sgetrune() doesn't give us any way to tell
@@ -77,5 +71,5 @@ mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
if (pwc != NULL)
*pwc = (wchar_t)r;
- return ((size_t)(e - s));
+ return (r != 0 ? (size_t)(e - s) : 0);
}
OpenPOWER on IntegriCloud