summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-05-23 00:05:15 +0000
committerguenther <guenther@openbsd.org>2016-05-23 00:05:15 +0000
commit558b4987cd4826b6cffb224fe684d5f8c1cda3f8 (patch)
treee277ff1ae2e373b8fec213ae499a6b328622c5af /lib/libc
parentAdd XOR cookies for r1 (stack) and lr. Switch from calling obsolete (diff)
downloadwireguard-openbsd-558b4987cd4826b6cffb224fe684d5f8c1cda3f8.tar.xz
wireguard-openbsd-558b4987cd4826b6cffb224fe684d5f8c1cda3f8.zip
Stop exposing <sys/localedef.h> and various symbols internal to the libc
locale implementation: _{Current,Default}*Locale, __[mn]locale_changed, __mb_len_max_runtime ok millert@ schwarze@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/Symbols.list13
-rw-r--r--lib/libc/include/localedef.h106
-rw-r--r--lib/libc/locale/__mb_cur_max.c7
-rw-r--r--lib/libc/locale/_def_messages.c4
-rw-r--r--lib/libc/locale/_def_monetary.c4
-rw-r--r--lib/libc/locale/_def_numeric.c4
-rw-r--r--lib/libc/locale/_def_time.c4
-rw-r--r--lib/libc/locale/localeconv.c8
-rw-r--r--lib/libc/locale/nl_langinfo.c5
-rw-r--r--lib/libc/locale/rune.h5
-rw-r--r--lib/libc/locale/setlocale.c4
-rw-r--r--lib/libc/time/strptime.c4
12 files changed, 129 insertions, 39 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index 5fbb8191a91..0c1b9e71c18 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -914,20 +914,7 @@ SipHash_Init
SipHash_Update
/* locale */
-_CurrentMessagesLocale
-_CurrentMonetaryLocale
-_CurrentNumericLocale
-_CurrentRuneLocale
-_CurrentTimeLocale
-_DefaultMessagesLocale
-_DefaultMonetaryLocale
-_DefaultNumericLocale
-_DefaultRuneLocale
-_DefaultTimeLocale
__mb_cur_max
-__mb_len_max_runtime
-__mlocale_changed
-__nlocale_changed
btowc
iswalnum
iswalpha
diff --git a/lib/libc/include/localedef.h b/lib/libc/include/localedef.h
new file mode 100644
index 00000000000..12dd47fffa0
--- /dev/null
+++ b/lib/libc/include/localedef.h
@@ -0,0 +1,106 @@
+/* $OpenBSD: localedef.h,v 1.1 2016/05/23 00:05:15 guenther Exp $ */
+/* $NetBSD: localedef.h,v 1.4 1996/04/09 20:55:31 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994 Winning Strategies, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Winning Strategies, Inc.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LOCALEDEF_H_
+#define _LOCALEDEF_H_
+
+#include <sys/types.h>
+
+typedef struct
+{
+ char *yesexpr;
+ char *noexpr;
+ char *yesstr;
+ char *nostr;
+} _MessagesLocale;
+
+
+typedef struct
+{
+ char *int_curr_symbol;
+ char *currency_symbol;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
+ char int_frac_digits;
+ char frac_digits;
+ char p_cs_precedes;
+ char p_sep_by_space;
+ char n_cs_precedes;
+ char n_sep_by_space;
+ char p_sign_posn;
+ char n_sign_posn;
+ char int_p_cs_precedes;
+ char int_p_sep_by_space;
+ char int_n_cs_precedes;
+ char int_n_sep_by_space;
+ char int_p_sign_posn;
+ char int_n_sign_posn;
+} _MonetaryLocale;
+
+
+typedef struct
+{
+ const char *decimal_point;
+ const char *thousands_sep;
+ const char *grouping;
+} _NumericLocale;
+
+
+typedef struct {
+ const char *abday[7];
+ const char *day[7];
+ const char *abmon[12];
+ const char *mon[12];
+ const char *am_pm[2];
+ const char *d_t_fmt;
+ const char *d_fmt;
+ const char *t_fmt;
+ const char *t_fmt_ampm;
+} _TimeLocale;
+
+
+__BEGIN_HIDDEN_DECLS
+extern const _MessagesLocale *_CurrentMessagesLocale;
+extern const _MessagesLocale _DefaultMessagesLocale;
+extern const _MonetaryLocale *_CurrentMonetaryLocale;
+extern const _MonetaryLocale _DefaultMonetaryLocale;
+extern const _NumericLocale *_CurrentNumericLocale;
+extern const _NumericLocale _DefaultNumericLocale;
+extern const _TimeLocale *_CurrentTimeLocale;
+extern const _TimeLocale _DefaultTimeLocale;
+__END_HIDDEN_DECLS
+
+#endif /* !_LOCALEDEF_H_ */
diff --git a/lib/libc/locale/__mb_cur_max.c b/lib/libc/locale/__mb_cur_max.c
index 42fbcad68dc..d1d30af1f6d 100644
--- a/lib/libc/locale/__mb_cur_max.c
+++ b/lib/libc/locale/__mb_cur_max.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: __mb_cur_max.c,v 1.4 2015/09/19 04:02:21 guenther Exp $ */
+/* $OpenBSD: __mb_cur_max.c,v 1.5 2016/05/23 00:05:15 guenther Exp $ */
/* $NetBSD: __mb_cur_max.c,v 1.2 2001/01/25 01:25:06 itojun Exp $ */
/*-
@@ -28,10 +28,5 @@
*/
#include <stdlib.h>
-#include <limits.h>
size_t __mb_cur_max = 1;
-size_t __mb_len_max_runtime = MB_LEN_MAX;
-#if 0
-DEF_STRONG(__mb_cur_max);
-#endif
diff --git a/lib/libc/locale/_def_messages.c b/lib/libc/locale/_def_messages.c
index 1ed653a9766..35b4345b50d 100644
--- a/lib/libc/locale/_def_messages.c
+++ b/lib/libc/locale/_def_messages.c
@@ -1,11 +1,11 @@
-/* $OpenBSD: _def_messages.c,v 1.5 2005/08/08 08:05:35 espie Exp $ */
+/* $OpenBSD: _def_messages.c,v 1.6 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <locale.h>
+#include "localedef.h"
const _MessagesLocale _DefaultMessagesLocale =
{
diff --git a/lib/libc/locale/_def_monetary.c b/lib/libc/locale/_def_monetary.c
index c050020ee4a..051c3b5903c 100644
--- a/lib/libc/locale/_def_monetary.c
+++ b/lib/libc/locale/_def_monetary.c
@@ -1,12 +1,12 @@
-/* $OpenBSD: _def_monetary.c,v 1.5 2014/07/14 07:22:07 pelikan Exp $ */
+/* $OpenBSD: _def_monetary.c,v 1.6 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <limits.h>
#include <locale.h>
+#include "localedef.h"
const _MonetaryLocale _DefaultMonetaryLocale =
{
diff --git a/lib/libc/locale/_def_numeric.c b/lib/libc/locale/_def_numeric.c
index 6511254ac01..d78e2b60a95 100644
--- a/lib/libc/locale/_def_numeric.c
+++ b/lib/libc/locale/_def_numeric.c
@@ -1,11 +1,11 @@
-/* $OpenBSD: _def_numeric.c,v 1.4 2005/08/08 08:05:35 espie Exp $ */
+/* $OpenBSD: _def_numeric.c,v 1.5 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <locale.h>
+#include "localedef.h"
const _NumericLocale _DefaultNumericLocale =
{
diff --git a/lib/libc/locale/_def_time.c b/lib/libc/locale/_def_time.c
index 75179a605f1..ba83fb88b81 100644
--- a/lib/libc/locale/_def_time.c
+++ b/lib/libc/locale/_def_time.c
@@ -1,11 +1,11 @@
-/* $OpenBSD: _def_time.c,v 1.5 2011/10/09 06:39:53 ajacoutot Exp $ */
+/* $OpenBSD: _def_time.c,v 1.6 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <locale.h>
+#include "localedef.h"
const _TimeLocale _DefaultTimeLocale =
{
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
index 1facb5484d4..7e9e5676616 100644
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -1,11 +1,11 @@
-/* $OpenBSD: localeconv.c,v 1.7 2015/09/14 12:21:03 guenther Exp $ */
+/* $OpenBSD: localeconv.c,v 1.8 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <locale.h>
+#include "localedef.h"
/*
* The localeconv() function constructs a struct lconv from the current
@@ -16,8 +16,8 @@
* lconv structure are computed only when the monetary or numeric
* locale has been changed.
*/
-int __mlocale_changed = 1;
-int __nlocale_changed = 1;
+static int __mlocale_changed = 1;
+static int __nlocale_changed = 1;
/*
* Return the current locale conversion.
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index a11b1cb65be..ea54dc668a0 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -1,13 +1,14 @@
-/* $OpenBSD: nl_langinfo.c,v 1.7 2015/09/14 12:22:49 guenther Exp $ */
+/* $OpenBSD: nl_langinfo.c,v 1.8 2016/05/23 00:05:15 guenther Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
-#include <sys/localedef.h>
#include <locale.h>
#include <nl_types.h>
#include <langinfo.h>
+
+#include "localedef.h"
#include "rune.h"
#include "runetype.h"
diff --git a/lib/libc/locale/rune.h b/lib/libc/locale/rune.h
index f3c93936133..98852f93fb7 100644
--- a/lib/libc/locale/rune.h
+++ b/lib/libc/locale/rune.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rune.h,v 1.2 2011/03/15 22:27:48 stsp Exp $ */
+/* $OpenBSD: rune.h,v 1.3 2016/05/23 00:05:15 guenther Exp $ */
/* $NetBSD: rune.h,v 1.9 2003/08/07 16:43:04 agc Exp $ */
/*-
@@ -73,8 +73,9 @@
/*
* global variables
*/
-extern size_t __mb_len_max_runtime;
+__BEGIN_HIDDEN_DECLS
extern _RuneLocale _DefaultRuneLocale;
extern _RuneLocale *_CurrentRuneLocale;
+__END_HIDDEN_DECLS
#endif /*! _RUNE_H_ */
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index b508c217213..04224da8fee 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setlocale.c,v 1.24 2015/09/14 12:21:03 guenther Exp $ */
+/* $OpenBSD: setlocale.c,v 1.25 2016/05/23 00:05:15 guenther Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/localedef.h>
#include <locale.h>
#include <limits.h>
#include <paths.h>
@@ -40,6 +39,7 @@
#include <string.h>
#include <unistd.h>
+#include "localedef.h"
#include "rune.h"
#include "rune_local.h"
/*
diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c
index fe78b476b98..2932575860d 100644
--- a/lib/libc/time/strptime.c
+++ b/lib/libc/time/strptime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strptime.c,v 1.21 2015/09/12 14:35:40 guenther Exp $ */
+/* $OpenBSD: strptime.c,v 1.22 2016/05/23 00:05:15 guenther Exp $ */
/* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */
/*-
* Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -28,12 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/localedef.h>
#include <ctype.h>
#include <locale.h>
#include <string.h>
#include <time.h>
+#include "localedef.h"
#include "private.h"
#include "tzfile.h"