size_t __wcsrtombs_chk (char *dst, const wchar_t **src, size_t len, mbstate_t *ps, size_t dstlen) { if (__builtin_expect (dstlen < len, 0)) __chk_fail (); return __wcsrtombs (dst, src, len, ps); }
size_t __wcstombs_chk (char *dst, const wchar_t *src, size_t len, size_t dstlen) { if (__glibc_unlikely (dstlen < len)) __chk_fail (); mbstate_t state; memset (&state, '\0', sizeof state); /* Return how many we wrote (or maybe an error). */ return __wcsrtombs (dst, &src, len, &state); }
/* Convert the `wchar_t' string in PWCS to a multibyte character string in S, writing no more than N characters. Return the number of bytes written, or (size_t) -1 if an invalid `wchar_t' was found. Attention: this function should NEVER be intentionally used. The interface is completely stupid. The state is shared between all conversion functions. You should use instead the restartable version `wcsrtombs'. */ size_t wcstombs (char *s, const wchar_t *pwcs, size_t n) { mbstate_t save_shift = __no_r_state; size_t written; written = __wcsrtombs (s, &pwcs, n, &__no_r_state); /* Restore the old shift state. */ __no_r_state = save_shift; /* Return how many we wrote (or maybe an error). */ return written; }