summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/string/wcscoll.c7
-rw-r--r--lib/libc/string/wcsxfrm.c7
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/libc/string/wcscoll.c b/lib/libc/string/wcscoll.c
index 79dad7d..b042a25 100644
--- a/lib/libc/string/wcscoll.c
+++ b/lib/libc/string/wcscoll.c
@@ -79,19 +79,16 @@ wcscoll(const wchar_t *ws1, const wchar_t *ws2)
static char *
__mbsdup(const wchar_t *ws)
{
- mbstate_t state;
const wchar_t *wcp;
size_t len;
char *mbs;
- memset(&state, 0, sizeof(state));
wcp = ws;
- if ((len = wcsrtombs(NULL, &wcp, 0, &state)) == (size_t)-1)
+ if ((len = wcsrtombs(NULL, &wcp, 0, NULL)) == (size_t)-1)
return (NULL);
if ((mbs = malloc(len + 1)) == NULL)
return (NULL);
- memset(&state, 0, sizeof(state));
- wcsrtombs(mbs, &ws, len + 1, &state);
+ wcsrtombs(mbs, &ws, len + 1, NULL);
return (mbs);
}
diff --git a/lib/libc/string/wcsxfrm.c b/lib/libc/string/wcsxfrm.c
index 4be6e46..4e988af 100644
--- a/lib/libc/string/wcsxfrm.c
+++ b/lib/libc/string/wcsxfrm.c
@@ -97,19 +97,16 @@ wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
static char *
__mbsdup(const wchar_t *ws)
{
- mbstate_t state;
const wchar_t *wcp;
size_t len;
char *mbs;
- memset(&state, 0, sizeof(state));
wcp = ws;
- if ((len = wcsrtombs(NULL, &wcp, 0, &state)) == (size_t)-1)
+ if ((len = wcsrtombs(NULL, &wcp, 0, NULL)) == (size_t)-1)
return (NULL);
if ((mbs = malloc(len + 1)) == NULL)
return (NULL);
- memset(&state, 0, sizeof(state));
- wcsrtombs(mbs, &ws, len + 1, &state);
+ wcsrtombs(mbs, &ws, len + 1, NULL);
return (mbs);
}
OpenPOWER on IntegriCloud