1#include <stdlib.h>2#include <string.h>3#include <wchar.h>45#undef mbstowcs67/*8 * we can reuse the internal state of mbstwocws() because9 * we loop in case of having a -2 from mbrtowc(), that10 * makes impossible to leave the function in a non initial11 * state (or error that cleans the state).12 */13size_t14mbstowcs(wchar_t *restrict dest, const char *restrict src, size_t n)15{16 return mbsrtowcs(dest, (void *) &src, n, NULL);17}