1*8a84c799SMatthew Dillon /*-
2*8a84c799SMatthew Dillon * Copyright (c) 2015 Matthew Dillon
3*8a84c799SMatthew Dillon * All rights reserved.
4*8a84c799SMatthew Dillon *
5*8a84c799SMatthew Dillon * Redistribution and use in source and binary forms, with or without
6*8a84c799SMatthew Dillon * modification, are permitted provided that the following conditions
7*8a84c799SMatthew Dillon * are met:
8*8a84c799SMatthew Dillon * 1. Redistributions of source code must retain the above copyright
9*8a84c799SMatthew Dillon * notice, this list of conditions and the following disclaimer.
10*8a84c799SMatthew Dillon * 2. Redistributions in binary form must reproduce the above copyright
11*8a84c799SMatthew Dillon * notice, this list of conditions and the following disclaimer in the
12*8a84c799SMatthew Dillon * documentation and/or other materials provided with the distribution.
13*8a84c799SMatthew Dillon *
14*8a84c799SMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*8a84c799SMatthew Dillon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*8a84c799SMatthew Dillon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*8a84c799SMatthew Dillon * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*8a84c799SMatthew Dillon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*8a84c799SMatthew Dillon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*8a84c799SMatthew Dillon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*8a84c799SMatthew Dillon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*8a84c799SMatthew Dillon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*8a84c799SMatthew Dillon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*8a84c799SMatthew Dillon * SUCH DAMAGE.
25*8a84c799SMatthew Dillon */
26*8a84c799SMatthew Dillon
27*8a84c799SMatthew Dillon #include <wchar.h>
28*8a84c799SMatthew Dillon #include "mblocal.h"
29*8a84c799SMatthew Dillon
30*8a84c799SMatthew Dillon size_t
mbintowcr_l(wchar_t * __restrict dst,const char * __restrict src,size_t dlen,size_t * slen,locale_t locale,int flags)31*8a84c799SMatthew Dillon mbintowcr_l(wchar_t * __restrict dst, const char * __restrict src,
32*8a84c799SMatthew Dillon size_t dlen, size_t *slen, locale_t locale, int flags)
33*8a84c799SMatthew Dillon {
34*8a84c799SMatthew Dillon FIX_LOCALE(locale);
35*8a84c799SMatthew Dillon return (XLOCALE_CTYPE(locale)->__mbintowcr(dst, src, dlen, slen,
36*8a84c799SMatthew Dillon flags));
37*8a84c799SMatthew Dillon }
38*8a84c799SMatthew Dillon
39*8a84c799SMatthew Dillon size_t
mbintowcr(wchar_t * __restrict dst,const char * __restrict src,size_t dlen,size_t * slen,int flags)40*8a84c799SMatthew Dillon mbintowcr(wchar_t * __restrict dst, const char * __restrict src,
41*8a84c799SMatthew Dillon size_t dlen, size_t *slen, int flags)
42*8a84c799SMatthew Dillon {
43*8a84c799SMatthew Dillon return mbintowcr_l(dst, src, dlen, slen, __get_locale(), flags);
44*8a84c799SMatthew Dillon }
45