1 /* mbsinit(mbstate_t *ps);
\r
3 This file is part of the Public Domain C Library (PDCLib).
\r
4 Permission is granted to use, modify, and / or redistribute at will.
\r
9 #include <_PDCLIB_encoding.h>
\r
10 #include <_PDCLIB_locale.h>
\r
12 int _PDCLIB_mbsinit_l( const mbstate_t *ps, locale_t l )
\r
15 return ps->_Surrogate == 0
\r
16 && ps->_PendState == 0
\r
17 && l->_Codec->__mbsinit(ps);
\r
21 int mbsinit( const mbstate_t * ps )
\r
23 return _PDCLIB_mbsinit_l(ps, _PDCLIB_threadlocale());
\r
29 #include <_PDCLIB_test.h>
\r
34 memset(&mbs, 0, sizeof mbs);
\r
36 TESTCASE(mbsinit(NULL) != 0);
\r
37 TESTCASE(mbsinit(&mbs) != 0);
\r
40 // Surrogate pending
\r
41 mbs._Surrogate = 0xFEED;
\r
42 TESTCASE(mbsinit(&mbs) == 0);
\r
46 TESTCASE(mbsinit(&mbs) == 0);
\r
48 return TEST_RESULTS;
\r