summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/wcsrtombs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/wcsrtombs.c')
-rw-r--r--lib/libc/locale/wcsrtombs.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/libc/locale/wcsrtombs.c b/lib/libc/locale/wcsrtombs.c
index f3b38b7..f6d1ca0 100644
--- a/lib/libc/locale/wcsrtombs.c
+++ b/lib/libc/locale/wcsrtombs.c
@@ -2,6 +2,11 @@
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -34,12 +39,18 @@ __FBSDID("$FreeBSD$");
#include "mblocal.h"
size_t
+wcsrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
+ mbstate_t * __restrict ps, locale_t locale)
+{
+ FIX_LOCALE(locale);
+ if (ps == NULL)
+ ps = &locale->wcsrtombs;
+ return (XLOCALE_CTYPE(locale)->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps));
+}
+
+size_t
wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
mbstate_t * __restrict ps)
{
- static mbstate_t mbs;
-
- if (ps == NULL)
- ps = &mbs;
- return (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps));
+ return wcsrtombs_l(dst, src, len, ps, __get_locale());
}
OpenPOWER on IntegriCloud