summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2016-05-23 00:05:16 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2016-05-23 00:05:16 +0000
commitace5b4f787765e2406a31a2cc9b6f4b62279fdb7 (patch)
tree6ca8b280ff61ea611222922c9614f511d790bf6a
parent48c90d4086eec1dd444519bfc288c17fb7237ae7 (diff)
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@
-rw-r--r--lib/libc/Symbols.list13
-rw-r--r--lib/libc/include/localedef.h (renamed from sys/sys/localedef.h)26
-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, 36 insertions, 52 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/sys/sys/localedef.h b/lib/libc/include/localedef.h
index ea71300680a..12dd47fffa0 100644
--- a/sys/sys/localedef.h
+++ b/lib/libc/include/localedef.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: localedef.h,v 1.5 2015/01/14 21:17:52 deraadt Exp $ */
+/* $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 $ */
/*
@@ -31,8 +31,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _SYS_LOCALEDEF_H_
-#define _SYS_LOCALEDEF_H_
+#ifndef _LOCALEDEF_H_
+#define _LOCALEDEF_H_
#include <sys/types.h>
@@ -44,9 +44,6 @@ typedef struct
char *nostr;
} _MessagesLocale;
-extern const _MessagesLocale *_CurrentMessagesLocale;
-extern const _MessagesLocale _DefaultMessagesLocale;
-
typedef struct
{
@@ -73,9 +70,6 @@ typedef struct
char int_n_sign_posn;
} _MonetaryLocale;
-extern const _MonetaryLocale *_CurrentMonetaryLocale;
-extern const _MonetaryLocale _DefaultMonetaryLocale;
-
typedef struct
{
@@ -84,9 +78,6 @@ typedef struct
const char *grouping;
} _NumericLocale;
-extern const _NumericLocale *_CurrentNumericLocale;
-extern const _NumericLocale _DefaultNumericLocale;
-
typedef struct {
const char *abday[7];
@@ -100,7 +91,16 @@ typedef struct {
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 /* !_SYS_LOCALEDEF_H_ */
+#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"