summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/Makefile3
-rw-r--r--locale/bits/types/__locale_t.h (renamed from locale/xlocale.h)24
-rw-r--r--locale/bits/types/locale_t.h26
-rw-r--r--locale/langinfo.h7
-rw-r--r--locale/locale.h20
5 files changed, 49 insertions, 31 deletions
diff --git a/locale/Makefile b/locale/Makefile
index d9ef48fe93..98ee76272d 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -22,7 +22,8 @@ subdir := locale
include ../Makeconfig
-headers = locale.h bits/locale.h langinfo.h xlocale.h
+headers = langinfo.h locale.h bits/locale.h \
+ bits/types/locale_t.h bits/types/__locale_t.h
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
newlocale duplocale freelocale uselocale
diff --git a/locale/xlocale.h b/locale/bits/types/__locale_t.h
index 20b2c1109f..4511aa1929 100644
--- a/locale/xlocale.h
+++ b/locale/bits/types/__locale_t.h
@@ -1,4 +1,4 @@
-/* Definition of locale datatype.
+/* Definition of struct __locale_struct and __locale_t.
Copyright (C) 1997-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -17,14 +17,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _XLOCALE_H
-#define _XLOCALE_H 1
+#ifndef _BITS_TYPES___LOCALE_T_H
+#define _BITS_TYPES___LOCALE_T_H 1
-/* Structure for reentrant locale using functions. This is an
- (almost) opaque type for the user level programs. The file and
- this data structure is not standardized. Don't rely on it. It can
- go away without warning. */
-typedef struct __locale_struct
+/* POSIX.1-2008: the locale_t type, representing a locale context
+ (implementation-namespace version). This type should be treated
+ as opaque by applications; some details are exposed for the sake of
+ efficiency in e.g. ctype functions. */
+
+struct __locale_struct
{
/* Note: LC_ALL is not a valid index into this array. */
struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */
@@ -36,9 +37,8 @@ typedef struct __locale_struct
/* Note: LC_ALL is not a valid index into this array. */
const char *__names[13];
-} *__locale_t;
+};
-/* POSIX 2008 makes locale_t official. */
-typedef __locale_t locale_t;
+typedef struct __locale_struct *__locale_t;
-#endif /* xlocale.h */
+#endif /* bits/types/__locale_t.h */
diff --git a/locale/bits/types/locale_t.h b/locale/bits/types/locale_t.h
new file mode 100644
index 0000000000..de7ec2ee84
--- /dev/null
+++ b/locale/bits/types/locale_t.h
@@ -0,0 +1,26 @@
+/* Definition of locale_t.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_TYPES_LOCALE_T_H
+#define _BITS_TYPES_LOCALE_T_H 1
+
+#include <bits/types/__locale_t.h>
+
+typedef __locale_t locale_t;
+
+#endif /* bits/types/locale_t.h */
diff --git a/locale/langinfo.h b/locale/langinfo.h
index 759adfbd1f..93d84463b5 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -584,11 +584,8 @@ extern char *nl_langinfo (nl_item __item) __THROW;
#ifdef __USE_XOPEN2K8
-/* This interface is for the extended locale model. See <locale.h> for
- more information. */
-
-/* Get locale datatype definition. */
-# include <xlocale.h>
+/* POSIX.1-2008 extended locale interface (see locale.h). */
+# include <bits/types/locale_t.h>
/* Just like nl_langinfo but get the information from the locale object L. */
extern char *nl_langinfo_l (nl_item __item, __locale_t __l);
diff --git a/locale/locale.h b/locale/locale.h
index 9a5fce9d47..6c1b22051b 100644
--- a/locale/locale.h
+++ b/locale/locale.h
@@ -126,19 +126,13 @@ extern struct lconv *localeconv (void) __THROW;
#ifdef __USE_XOPEN2K8
-/* The concept of one static locale per category is not very well
- thought out. Many applications will need to process its data using
- information from several different locales. Another application is
- the implementation of the internationalization handling in the
- upcoming ISO C++ standard library. To support this another set of
- the functions using locale data exist which have an additional
- argument.
-
- Attention: all these functions are *not* standardized in any form.
- This is a proof-of-concept implementation. */
-
-/* Get locale datatype definition. */
-# include <xlocale.h>
+/* POSIX.1-2008 extends the locale interface with functions for
+ explicit creation and manipulation of 'locale_t' objects
+ representing locale contexts, and a set of parallel
+ locale-sensitive text processing functions that take a locale_t
+ argument. This enables applications to work with data from
+ multiple locales simultaneously and thread-safely. */
+# include <bits/types/locale_t.h>
/* Return a reference to a data structure representing a set of locale
datasets. Unlike for the CATEGORY parameter for `setlocale' the