1108983Simp/*-
2108983Simp * Copyright (c) 2002-2004 Tim J. Robbins.
3108983Simp * All rights reserved.
4108983Simp *
5108983Simp * Copyright (c) 2011 The FreeBSD Foundation
6108983Simp * All rights reserved.
7108983Simp * Portions of this software were developed by David Chisnall
8108983Simp * under sponsorship from the FreeBSD Foundation.
9108983Simp *
10108983Simp * Redistribution and use in source and binary forms, with or without
11108983Simp * modification, are permitted provided that the following conditions
12108983Simp * are met:
13108983Simp * 1. Redistributions of source code must retain the above copyright
14108983Simp *    notice, this list of conditions and the following disclaimer.
15108983Simp * 2. Redistributions in binary form must reproduce the above copyright
16108983Simp *    notice, this list of conditions and the following disclaimer in the
17108983Simp *    documentation and/or other materials provided with the distribution.
18108983Simp *
19108983Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20130151Sschweikh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21134867Sglebius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22139027Sbrueffer * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23139027Sbrueffer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24139027Sbrueffer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25108983Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26139027Sbrueffer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27139027Sbrueffer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28139027Sbrueffer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29108983Simp * SUCH DAMAGE.
30108983Simp */
31108983Simp
32108983Simp#include <sys/cdefs.h>
33108983Simp__FBSDID("$FreeBSD$");
34108983Simp
35108983Simp#include <wchar.h>
36126905Scperciva#include "mblocal.h"
37108983Simp
38108983Simpint
39108983Simpmbsinit_l(const mbstate_t *ps, locale_t locale)
40108983Simp{
41108983Simp	FIX_LOCALE(locale);
42108983Simp	return (XLOCALE_CTYPE(locale)->__mbsinit(ps));
43108983Simp}
44108983Simpint
45108983Simpmbsinit(const mbstate_t *ps)
46108983Simp{
47108983Simp	return mbsinit_l(ps, __get_locale());
48108983Simp}
49108983Simp