scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

mbstowcs.c (428B)


      1 #include <stdlib.h>
      2 #include <string.h>
      3 #include <wchar.h>
      4 
      5 #undef mbstowcs
      6 
      7 /*
      8  * we can reuse the internal state of mbstwocws() because
      9  * we loop in case of having a -2 from mbrtowc(), that
     10  * makes impossible to leave the function in a non initial
     11  * state (or error that cleans the state).
     12  */
     13 size_t
     14 mbstowcs(wchar_t *restrict dest, const char *restrict src, size_t n)
     15 {
     16 	return mbsrtowcs(dest, (void *) &src, n, NULL);
     17 }