summaryrefslogtreecommitdiff
path: root/lib/wcsnrtombs-impl.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-01-10 23:28:47 +0100
committerBruno Haible <bruno@clisp.org>2020-01-10 23:28:47 +0100
commit980b40b1d6464d3aa9e68d8a0c19009c6cdaf6fb (patch)
treef1f7b75cf983113e5e6c6a0aacce1918be65a3ea /lib/wcsnrtombs-impl.h
parentf5eb8cea72469348b423ae22068eeb9e1399011b (diff)
downloadgnulib-980b40b1d6464d3aa9e68d8a0c19009c6cdaf6fb.tar.gz
c32snrtombs: New module.
* lib/uchar.in.h (c32snrtombs): New declaration. * lib/wcsnrtombs-impl.h: Parameterize: Use macros FUNC, SCHAR_T, INTERNAL_STATE, WCRTOMB. * lib/wcsnrtombs.c (FUNC, SCHAR_T, INTERNAL_STATE, WCRTOMB): New macros. * lib/c32snrtombs.c: New file. * m4/uchar.m4 (gl_UCHAR_H_DEFAULTS): Initialize GNULIB_C32SNRTOMBS. * modules/uchar (Makefile.am): Substitute GNULIB_C32SNRTOMBS. * modules/c32snrtombs: New file. * tests/test-uchar-c++.cc: Test the signature of c32snrtombs. * doc/posix-functions/wcsnrtombs.texi: Mention the new module.
Diffstat (limited to 'lib/wcsnrtombs-impl.h')
-rw-r--r--lib/wcsnrtombs-impl.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/wcsnrtombs-impl.h b/lib/wcsnrtombs-impl.h
index b50c6c0527..7af3b361b1 100644
--- a/lib/wcsnrtombs-impl.h
+++ b/lib/wcsnrtombs-impl.h
@@ -16,12 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */
size_t
-wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
+FUNC (char *dest, const SCHAR_T **srcp, size_t srclen, size_t len, mbstate_t *ps)
{
if (ps == NULL)
- ps = &_gl_wcsrtombs_state;
+ ps = &INTERNAL_STATE;
{
- const wchar_t *src = *srcp;
+ const SCHAR_T *src = *srcp;
size_t cur_max = MB_CUR_MAX;
char buf[64];
@@ -34,8 +34,8 @@ wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate
for (; srclen > 0 && len > 0; src++, srclen--)
{
- wchar_t wc = *src;
- size_t ret = wcrtomb (len >= cur_max ? destptr : buf, wc, ps);
+ SCHAR_T wc = *src;
+ size_t ret = WCRTOMB (len >= cur_max ? destptr : buf, wc, ps);
if (ret == (size_t)(-1))
goto bad_input;
@@ -66,8 +66,8 @@ wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate
for (; srclen > 0; src++, srclen--)
{
- wchar_t wc = *src;
- size_t ret = wcrtomb (buf, wc, &state);
+ SCHAR_T wc = *src;
+ size_t ret = WCRTOMB (buf, wc, &state);
if (ret == (size_t)(-1))
goto bad_input2;