1*81d0329eSjoerg /* $NetBSD: duplocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $ */
2*81d0329eSjoerg
3*81d0329eSjoerg /*-
4*81d0329eSjoerg * Copyright (c)2008, 2011 Citrus Project,
5*81d0329eSjoerg * All rights reserved.
6*81d0329eSjoerg *
7*81d0329eSjoerg * Redistribution and use in source and binary forms, with or without
8*81d0329eSjoerg * modification, are permitted provided that the following conditions
9*81d0329eSjoerg * are met:
10*81d0329eSjoerg * 1. Redistributions of source code must retain the above copyright
11*81d0329eSjoerg * notice, this list of conditions and the following disclaimer.
12*81d0329eSjoerg * 2. Redistributions in binary form must reproduce the above copyright
13*81d0329eSjoerg * notice, this list of conditions and the following disclaimer in the
14*81d0329eSjoerg * documentation and/or other materials provided with the distribution.
15*81d0329eSjoerg *
16*81d0329eSjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*81d0329eSjoerg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*81d0329eSjoerg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*81d0329eSjoerg * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*81d0329eSjoerg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*81d0329eSjoerg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*81d0329eSjoerg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*81d0329eSjoerg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*81d0329eSjoerg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*81d0329eSjoerg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*81d0329eSjoerg * SUCH DAMAGE.
27*81d0329eSjoerg */
28*81d0329eSjoerg
29*81d0329eSjoerg #include <sys/cdefs.h>
30*81d0329eSjoerg __RCSID("$NetBSD: duplocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $");
31*81d0329eSjoerg
32*81d0329eSjoerg #include "namespace.h"
33*81d0329eSjoerg
34*81d0329eSjoerg #include <stdlib.h>
35*81d0329eSjoerg #include <locale.h>
36*81d0329eSjoerg #include <string.h>
37*81d0329eSjoerg
38*81d0329eSjoerg #include "setlocale_local.h"
39*81d0329eSjoerg
__weak_alias(duplocale,_duplocale)40*81d0329eSjoerg __weak_alias(duplocale, _duplocale)
41*81d0329eSjoerg
42*81d0329eSjoerg locale_t
43*81d0329eSjoerg duplocale(locale_t src)
44*81d0329eSjoerg {
45*81d0329eSjoerg struct _locale *dst;
46*81d0329eSjoerg
47*81d0329eSjoerg dst = malloc(sizeof(*dst));
48*81d0329eSjoerg if (dst != NULL)
49*81d0329eSjoerg memcpy(dst, src, sizeof(*dst));
50*81d0329eSjoerg
51*81d0329eSjoerg return dst;
52*81d0329eSjoerg }
53