summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/wcstombs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/wcstombs.c')
-rw-r--r--lib/libc/locale/wcstombs.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/locale/wcstombs.c b/lib/libc/locale/wcstombs.c
index 250d2b9..8d4ae1c 100644
--- a/lib/libc/locale/wcstombs.c
+++ b/lib/libc/locale/wcstombs.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:
@@ -33,13 +38,21 @@ __FBSDID("$FreeBSD$");
#include "mblocal.h"
size_t
-wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
+wcstombs_l(char * __restrict s, const wchar_t * __restrict pwcs, size_t n,
+ locale_t locale)
{
static const mbstate_t initial;
mbstate_t mbs;
const wchar_t *pwcsp;
+ FIX_LOCALE(locale);
mbs = initial;
pwcsp = pwcs;
- return (__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs));
+ return (XLOCALE_CTYPE(locale)->__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs));
+}
+size_t
+wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
+{
+ return wcstombs_l(s, pwcs, n, __get_locale());
}
+
OpenPOWER on IntegriCloud