summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 19:14:56 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 19:14:56 +0200
commitf76453c31593957fec1a99b986bfa5506618b79c (patch)
treeda353c882fb9b2261c9871bcb9e3876a3e6ed7f6 /locale
parent58695b88a9deaecbcf7794760cc333177edaa2b4 (diff)
parent78bd7499af46d739ce94410eaeea006e874ca9e5 (diff)
Merge tag 'glibc-2.22' into baseline
The GNU C Library ================= The GNU C Library version 2.22 is now available. The GNU C Library is used as *the* C library in the GNU system and in GNU/Linux systems, as well as many other systems that use Linux as the kernel. The GNU C Library is primarily designed to be a portable and high performance C library. It follows all relevant standards including ISO C11 and POSIX.1-2008. It is also internationalized and has one of the most complete internationalization interfaces known. The GNU C Library webpage is at http://www.gnu.org/software/libc/ Packages for the 2.22 release may be downloaded from: http://ftpmirror.gnu.org/libc/ http://ftp.gnu.org/gnu/libc/ The mirror list is at http://www.gnu.org/order/ftp.html NEWS for version 2.22 ===================== * The following bugs are resolved with this release: 438, 4719, 6544, 6792, 11216, 12836, 13028, 13064, 13151, 13152, 14094, 14292, 14841, 14906, 14958, 15319, 15467, 15790, 15969, 16159, 16339, 16350, 16351, 16352, 16353, 16361, 16512, 16526, 16538, 16559, 16560, 16704, 16783, 16850, 17053, 17090, 17195, 17269, 17293, 17322, 17403, 17475, 17523, 17542, 17569, 17581, 17588, 17596, 17620, 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17833, 17836, 17841, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967, 17969, 17977, 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029, 18030, 18032, 18034, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18116, 18125, 18128, 18134, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217, 18219, 18220, 18221, 18234, 18244, 18245, 18247, 18287, 18319, 18324, 18333, 18346, 18371, 18383, 18397, 18400, 18409, 18410, 18412, 18418, 18422, 18434, 18444, 18457, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18502, 18507, 18508, 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546, 18547, 18549, 18553, 18557, 18558, 18569, 18583, 18585, 18586, 18592, 18593, 18594, 18602, 18612, 18613, 18619, 18633, 18641, 18643, 18648, 18657, 18676, 18694, 18696. * Cache information can be queried via sysconf() function on s390 e.g. with _SC_LEVEL1_ICACHE_SIZE as argument. * A buffer overflow in gethostbyname_r and related functions performing DNS requests has been fixed. If the NSS functions were called with a misaligned buffer, the buffer length change due to pointer alignment was not taken into account. This could result in application crashes or, potentially arbitrary code execution, using crafted, but syntactically valid DNS responses. (CVE-2015-1781) * The time zone file parser has been made more robust against crafted time zone files, avoiding heap buffer overflows related to the processing of the tzh_ttisstdcnt and tzh_ttisgmtcnt fields, and a stack overflow due to large time zone data files. Overly long time zone specifiers in the TZ variable no longer result in stack overflows and crashes. * A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors for LD and GD on x86 and x86-64, has been implemented. You will need binutils-2.24 or later to enable this optimization. * Character encoding and ctype tables were updated to Unicode 7.0.0, using new generator scripts contributed by Pravin Satpute and Mike FABIAN (Red Hat). These updates cause user visible changes, such as the fix for bug 17998. * CVE-2014-8121 The NSS backends shared internal state between the getXXent and getXXbyYY NSS calls for the same database, causing a denial-of-service condition in some applications. * Added vector math library named libmvec with the following vectorized x86_64 implementations: cos, cosf, sin, sinf, sincos, sincosf, log, logf, exp, expf, pow, powf. The library can be disabled with --disable-mathvec. Use of the functions is enabled with -fopenmp -ffast-math starting from -O1 for GCC version >= 4.9.0. Shared library libmvec.so is linked in as needed when using -lm (no need to specify -lmvec explicitly for not static builds). Visit <https://sourceware.org/glibc/wiki/libmvec> for detailed information. * A new fmemopen implementation has been added with the goal of POSIX compliance. The new implementation fixes the following long-standing issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and BZ#14292. The old implementation is still present for use be by existing binaries. * The 32-bit sparc sigaction ABI was inadvertently broken in the 2.20 and 2.21 releases. It has been fixed to match 2.19 and older, but binaries built against 2.20 and 2.21 might need to be recompiled. See BZ#18694. * Port to Native Client running on ARMv7-A (--host=arm-nacl). Contributed by Roland McGrath (Google). Contributors ============ This release was made possible by the contributions of many people. The maintainers are grateful to everyone who has contributed changes or bug reports. These include: Adhemerval Zanella Alan Modra Alexandre Oliva Andreas Schwab Andrew Senkevich Andriy Rysin Arjun Shankar Aurelien Jarno Benno Schulenberg Brad Hubbard Carlos O'Donell Chris Metcalf Christian Schmidt Chung-Lin Tang Cong Wang Cyril Hrubis Daniel Marjamäki David S. Miller Dmitry V. Levin Eric Rannaud Evangelos Foutras Feng Gao Florian Weimer Gleb Fotengauer-Malinovskiy H.J. Lu Igor Zamyatin J William Piggott James Cowgill James Lemke John David Anglin Joseph Myers Kevin Easton Khem Raj Leonhard Holz Mark Wielaard Marko Myllynen Martin Galvan Martin Sebor Matthew Fortune Mel Gorman Mike Frysinger Miroslav Lichvar Nathan Lynch Ondřej Bílka Paul Eggert Paul Pluzhnikov Pavel Kopyl Pravin Satpute Rajalakshmi Srinivasaraghavan Rical Jasan Richard Henderson Roland McGrath Rüdiger Sonderfeld Samuel Thibault Siddhesh Poyarekar Stefan Liebler Steve Ellcey Szabolcs Nagy Torvald Riegel Tulio Magno Quites Machado Filho Vincent Bernat Wilco Dijkstra Yaakov Selkowitz Zack Weinberg
Diffstat (limited to 'locale')
-rw-r--r--locale/C-address.c2
-rw-r--r--locale/C-collate.c6
-rw-r--r--locale/C-ctype.c19
-rw-r--r--locale/C-identification.c2
-rw-r--r--locale/C-measurement.c2
-rw-r--r--locale/C-messages.c2
-rw-r--r--locale/C-monetary.c2
-rw-r--r--locale/C-name.c2
-rw-r--r--locale/C-numeric.c2
-rw-r--r--locale/C-paper.c2
-rw-r--r--locale/C-telephone.c2
-rw-r--r--locale/C-time.c2
-rw-r--r--locale/C-translit.h.in2
-rw-r--r--locale/Makefile13
-rw-r--r--locale/bits/locale.h2
-rw-r--r--locale/broken_cur_max.c2
-rw-r--r--locale/categories.def3
-rw-r--r--locale/coll-lookup.c2
-rw-r--r--locale/coll-lookup.h2
-rw-r--r--locale/duplocale.c2
-rw-r--r--locale/elem-hash.h2
-rw-r--r--locale/findlocale.c109
-rw-r--r--locale/freelocale.c2
-rw-r--r--locale/global-locale.c2
-rw-r--r--locale/hashval.h2
-rw-r--r--locale/indigits.h2
-rw-r--r--locale/indigitswc.h2
-rw-r--r--locale/iso-4217.def1
-rw-r--r--locale/iso-639.def2
-rw-r--r--locale/langinfo.h3
-rw-r--r--locale/lc-address.c2
-rw-r--r--locale/lc-collate.c2
-rw-r--r--locale/lc-ctype.c2
-rw-r--r--locale/lc-identification.c2
-rw-r--r--locale/lc-measurement.c2
-rw-r--r--locale/lc-messages.c2
-rw-r--r--locale/lc-monetary.c2
-rw-r--r--locale/lc-name.c2
-rw-r--r--locale/lc-numeric.c2
-rw-r--r--locale/lc-paper.c2
-rw-r--r--locale/lc-telephone.c2
-rw-r--r--locale/lc-time.c2
-rw-r--r--locale/loadarchive.c10
-rw-r--r--locale/loadlocale.c12
-rw-r--r--locale/locale.h2
-rw-r--r--locale/localeconv.c2
-rw-r--r--locale/localeinfo.h10
-rw-r--r--locale/localename.c2
-rw-r--r--locale/locarchive.h2
-rw-r--r--locale/mb_cur_max.c2
-rw-r--r--locale/newlocale.c2
-rw-r--r--locale/nl_langinfo.c2
-rw-r--r--locale/nl_langinfo_l.c17
-rw-r--r--locale/outdigits.h2
-rw-r--r--locale/outdigitswc.h2
-rw-r--r--locale/programs/3level.h2
-rw-r--r--locale/programs/charmap-dir.c2
-rw-r--r--locale/programs/charmap-dir.h2
-rw-r--r--locale/programs/charmap-kw.gperf2
-rw-r--r--locale/programs/charmap-kw.h2
-rw-r--r--locale/programs/charmap.c2
-rw-r--r--locale/programs/charmap.h2
-rw-r--r--locale/programs/config.h2
-rw-r--r--locale/programs/ld-address.c2
-rw-r--r--locale/programs/ld-collate.c11
-rw-r--r--locale/programs/ld-ctype.c357
-rw-r--r--locale/programs/ld-identification.c2
-rw-r--r--locale/programs/ld-measurement.c2
-rw-r--r--locale/programs/ld-messages.c2
-rw-r--r--locale/programs/ld-monetary.c2
-rw-r--r--locale/programs/ld-name.c2
-rw-r--r--locale/programs/ld-numeric.c2
-rw-r--r--locale/programs/ld-paper.c2
-rw-r--r--locale/programs/ld-telephone.c2
-rw-r--r--locale/programs/ld-time.c2
-rw-r--r--locale/programs/linereader.c2
-rw-r--r--locale/programs/linereader.h2
-rw-r--r--locale/programs/locale-spec.c2
-rw-r--r--locale/programs/locale.c267
-rw-r--r--locale/programs/localedef.c4
-rw-r--r--locale/programs/localedef.h2
-rw-r--r--locale/programs/locarchive.c2
-rw-r--r--locale/programs/locfile-kw.gperf2
-rw-r--r--locale/programs/locfile-kw.h2
-rw-r--r--locale/programs/locfile-token.h2
-rw-r--r--locale/programs/locfile.c4
-rw-r--r--locale/programs/locfile.h5
-rw-r--r--locale/programs/repertoire.c4
-rw-r--r--locale/programs/repertoire.h2
-rw-r--r--locale/programs/simple-hash.c12
-rw-r--r--locale/programs/simple-hash.h2
-rw-r--r--locale/programs/xmalloc.c2
-rw-r--r--locale/programs/xstrdup.c2
-rw-r--r--locale/setlocale.c18
-rw-r--r--locale/strlen-hash.h2
-rw-r--r--locale/tst-C-locale.c2
-rw-r--r--locale/uselocale.c2
-rw-r--r--locale/weight.h15
-rw-r--r--locale/weightwc.h15
-rw-r--r--locale/xlocale.c2
-rw-r--r--locale/xlocale.h2
101 files changed, 547 insertions, 526 deletions
diff --git a/locale/C-address.c b/locale/C-address.c
index 1fc2364432..d740505f47 100644
--- a/locale/C-address.c
+++ b/locale/C-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-collate.c b/locale/C-collate.c
index 447233fc5c..d7f3c550a5 100644
--- a/locale/C-collate.c
+++ b/locale/C-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -144,6 +144,8 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
/* _NL_COLLATE_COLLSEQWC */
{ .string = (const char *) collseqwc },
/* _NL_COLLATE_CODESET */
- { .string = _nl_C_codeset }
+ { .string = _nl_C_codeset },
+ /* _NL_COLLATE_ENCODING_TYPE */
+ { .word = __cet_8bit }
}
};
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index b3fac115e3..aa5f19f838 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -569,22 +569,9 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
{ .string = NULL },
/* _NL_CTYPE_CLASS_NAMES */
{ .string = "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
- "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0"
-#ifdef PREDEFINED_CLASSES
- "left_to_right\0" "right_to_left\0" "num_terminator\0"
- "num_separator\0" "segment_separator\0" "block_separator\0"
- "direction_control\0" "sym_swap_layout\0" "char_shape_selector\0"
- "num_shape_selector\0" "non_spacing\0" "non_spacing_level3\0"
- "r_connect\0" "no_connect\0" "no_connect-space\0"
- "vowel_connect\0"
-#endif
- },
+ "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" },
/* _NL_CTYPE_MAP_NAMES */
- { .string = "toupper\0" "tolower\0"
-#ifdef PREDEFINED_CLASSES
- "tosymmetric\0"
-#endif
- },
+ { .string = "toupper\0" "tolower\0" },
/* _NL_CTYPE_WIDTH */
{ .string = (const char *) _nl_C_LC_CTYPE_width.header },
/* _NL_CTYPE_MB_CUR_MAX */
diff --git a/locale/C-identification.c b/locale/C-identification.c
index a306d93730..3864279faf 100644
--- a/locale/C-identification.c
+++ b/locale/C-identification.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-measurement.c b/locale/C-measurement.c
index 14116343ba..34ec1e8fbd 100644
--- a/locale/C-measurement.c
+++ b/locale/C-measurement.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-messages.c b/locale/C-messages.c
index ab2c75a99b..bf25bd4e7b 100644
--- a/locale/C-messages.c
+++ b/locale/C-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
diff --git a/locale/C-monetary.c b/locale/C-monetary.c
index d90631f371..e6066e57ea 100644
--- a/locale/C-monetary.c
+++ b/locale/C-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
diff --git a/locale/C-name.c b/locale/C-name.c
index 29c1b50c78..38659ac11c 100644
--- a/locale/C-name.c
+++ b/locale/C-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-numeric.c b/locale/C-numeric.c
index 121263e318..6703d3593a 100644
--- a/locale/C-numeric.c
+++ b/locale/C-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
diff --git a/locale/C-paper.c b/locale/C-paper.c
index 0b0129d98b..949aefbccc 100644
--- a/locale/C-paper.c
+++ b/locale/C-paper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-telephone.c b/locale/C-telephone.c
index a8b49ba301..b2300ad992 100644
--- a/locale/C-telephone.c
+++ b/locale/C-telephone.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/C-time.c b/locale/C-time.c
index 8731f39e51..7b5342549f 100644
--- a/locale/C-time.c
+++ b/locale/C-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/C-translit.h.in b/locale/C-translit.h.in
index dbe8723328..71bef640a3 100644
--- a/locale/C-translit.h.in
+++ b/locale/C-translit.h.in
@@ -1,5 +1,5 @@
/* Transliteration for the C locale. -*-C-*-
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
diff --git a/locale/Makefile b/locale/Makefile
index 51b383afa8..f1b4343935 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2014 Free Software Foundation, Inc.
+# Copyright (C) 1991-2015 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
@@ -20,6 +20,8 @@
#
subdir := locale
+include ../Makeconfig
+
headers = locale.h bits/locale.h langinfo.h xlocale.h
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
@@ -86,15 +88,14 @@ locale-CPPFLAGS = -DLOCALEDIR='"$(localedir)"' \
CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
-DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
-DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
- -DLOCSRCDIR='"$(i18ndir)/locales"' \
- -DHAVE_CONFIG_H -DNOT_IN_libc
+ -DLOCSRCDIR='"$(i18ndir)/locales"'
CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c = -Wno-write-strings
-# This makes sure -DNOT_IN_libc et al are passed for all these modules.
-cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
- $(locale-modules) $(lib-modules))
+# Set libof-* for each routine.
+cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
+ $(lib-modules)
lib := locale-programs
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
diff --git a/locale/bits/locale.h b/locale/bits/locale.h
index 481228f686..41939e2880 100644
--- a/locale/bits/locale.h
+++ b/locale/bits/locale.h
@@ -1,5 +1,5 @@
/* Definition of locale category symbol values.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 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
diff --git a/locale/broken_cur_max.c b/locale/broken_cur_max.c
index 7d213402be..1eddbc8ba8 100644
--- a/locale/broken_cur_max.c
+++ b/locale/broken_cur_max.c
@@ -1,6 +1,6 @@
/* Return number of characters in multibyte representation for current
character set.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/locale/categories.def b/locale/categories.def
index 6a53a6bf7c..045489d741 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -1,5 +1,5 @@
/* Definition of all available locale categories and their items. -*- C -*-
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
@@ -58,6 +58,7 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring)
DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring)
DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string)
+ DEFINE_ELEMENT (_NL_COLLATE_ENCODING_TYPE, "collate-encoding-type", std, word)
), NO_POSTLOAD)
diff --git a/locale/coll-lookup.c b/locale/coll-lookup.c
index dd2a1d7305..a07c497005 100644
--- a/locale/coll-lookup.c
+++ b/locale/coll-lookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
diff --git a/locale/coll-lookup.h b/locale/coll-lookup.h
index ed65341edf..504b7f1292 100644
--- a/locale/coll-lookup.h
+++ b/locale/coll-lookup.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
diff --git a/locale/duplocale.c b/locale/duplocale.c
index 5ea80e59b2..dd048405f8 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -1,5 +1,5 @@
/* Duplicate handle for selection of locales.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/locale/elem-hash.h b/locale/elem-hash.h
index 177e0bc645..74da88ec13 100644
--- a/locale/elem-hash.h
+++ b/locale/elem-hash.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper, <drepper@cygnus.com>.
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 0c42b99251..9e7df12c72 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <assert.h>
+#include <errno.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
@@ -57,6 +58,45 @@ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
+/* Checks if the name is actually present, that is, not NULL and not
+ empty. */
+static inline int
+name_present (const char *name)
+{
+ return name != NULL && name[0] != '\0';
+}
+
+/* Checks that the locale name neither extremely long, nor contains a
+ ".." path component (to prevent directory traversal). */
+static inline int
+valid_locale_name (const char *name)
+{
+ /* Not set. */
+ size_t namelen = strlen (name);
+ /* Name too long. The limit is arbitrary and prevents stack overflow
+ issues later. */
+ if (__glibc_unlikely (namelen > 255))
+ return 0;
+ /* Directory traversal attempt. */
+ static const char slashdot[4] = {'/', '.', '.', '/'};
+ if (__glibc_unlikely (__memmem (name, namelen,
+ slashdot, sizeof (slashdot)) != NULL))
+ return 0;
+ if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
+ return 0;
+ if (namelen >= 3
+ && __glibc_unlikely (((name[0] == '.'
+ && name[1] == '.'
+ && name[2] == '/')
+ || (name[namelen - 3] == '/'
+ && name[namelen - 2] == '.'
+ && name[namelen - 1] == '.'))))
+ return 0;
+ /* If there is a slash in the name, it must start with one. */
+ if (__glibc_unlikely (memchr (name, '/', namelen) != NULL) && name[0] != '/')
+ return 0;
+ return 1;
+}
struct __locale_data *
internal_function
@@ -65,7 +105,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
{
int mask;
/* Name of the locale for this category. */
- char *loc_name;
+ const char *cloc_name = *name;
const char *language;
const char *modifier;
const char *territory;
@@ -73,56 +113,75 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
const char *normalized_codeset;
struct loaded_l10nfile *locale_file;
- if ((*name)[0] == '\0')
+ if (cloc_name[0] == '\0')
{
/* The user decides which locale to use by setting environment
variables. */
- *name = getenv ("LC_ALL");
- if (*name == NULL || (*name)[0] == '\0')
- *name = getenv (_nl_category_names.str
- + _nl_category_name_idxs[category]);
- if (*name == NULL || (*name)[0] == '\0')
- *name = getenv ("LANG");
+ cloc_name = getenv ("LC_ALL");
+ if (!name_present (cloc_name))
+ cloc_name = getenv (_nl_category_names.str
+ + _nl_category_name_idxs[category]);
+ if (!name_present (cloc_name))
+ cloc_name = getenv ("LANG");
+ if (!name_present (cloc_name))
+ cloc_name = _nl_C_name;
}
- if (*name == NULL || (*name)[0] == '\0'
- || (__builtin_expect (__libc_enable_secure, 0)
- && strchr (*name, '/') != NULL))
- *name = (char *) _nl_C_name;
+ /* We used to fall back to the C locale if the name contains a slash
+ character '/', but we now check for directory traversal in
+ valid_locale_name, so this is no longer necessary. */
- if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
- || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
+ if (__builtin_expect (strcmp (cloc_name, _nl_C_name), 1) == 0
+ || __builtin_expect (strcmp (cloc_name, _nl_POSIX_name), 1) == 0)
{
/* We need not load anything. The needed data is contained in
the library itself. */
- *name = (char *) _nl_C_name;
+ *name = _nl_C_name;
return _nl_C[category];
}
+ else if (!valid_locale_name (cloc_name))
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ *name = cloc_name;
/* We really have to load some data. First we try the archive,
but only if there was no LOCPATH environment variable specified. */
- if (__builtin_expect (locale_path == NULL, 1))
+ if (__glibc_likely (locale_path == NULL))
{
struct __locale_data *data
= _nl_load_locale_from_archive (category, name);
- if (__builtin_expect (data != NULL, 1))
+ if (__glibc_likely (data != NULL))
return data;
+ /* Nothing in the archive with the given name. Expanding it as
+ an alias and retry. */
+ cloc_name = _nl_expand_alias (*name);
+ if (cloc_name != NULL)
+ {
+ data = _nl_load_locale_from_archive (category, &cloc_name);
+ if (__builtin_expect (data != NULL, 1))
+ return data;
+ }
+
/* Nothing in the archive. Set the default path to search below. */
locale_path = _nl_default_locale_path;
locale_path_len = sizeof _nl_default_locale_path;
}
+ else
+ /* We really have to load some data. First see whether the name is
+ an alias. Please note that this makes it impossible to have "C"
+ or "POSIX" as aliases. */
+ cloc_name = _nl_expand_alias (*name);
- /* We really have to load some data. First see whether the name is
- an alias. Please note that this makes it impossible to have "C"
- or "POSIX" as aliases. */
- loc_name = (char *) _nl_expand_alias (*name);
- if (loc_name == NULL)
+ if (cloc_name == NULL)
/* It is no alias. */
- loc_name = (char *) *name;
+ cloc_name = *name;
/* Make a writable copy of the locale name. */
- loc_name = strdupa (loc_name);
+ char *loc_name = strdupa (cloc_name);
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
diff --git a/locale/freelocale.c b/locale/freelocale.c
index 4d3b70c8c1..51f723ec40 100644
--- a/locale/freelocale.c
+++ b/locale/freelocale.c
@@ -1,5 +1,5 @@
/* Free data allocated by a call to setlocale_r
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/locale/global-locale.c b/locale/global-locale.c
index b0799fbb38..25c82782dd 100644
--- a/locale/global-locale.c
+++ b/locale/global-locale.c
@@ -1,5 +1,5 @@
/* Locale object representing the global locale controlled by setlocale.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/locale/hashval.h b/locale/hashval.h
index eadb513d2c..9a79d45f76 100644
--- a/locale/hashval.h
+++ b/locale/hashval.h
@@ -1,5 +1,5 @@
/* Implement simple hashing table with string based keys.
- Copyright (C) 1994-2014 Free Software Foundation, Inc.
+ Copyright (C) 1994-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
diff --git a/locale/indigits.h b/locale/indigits.h
index f251efdd2e..59068c5ca1 100644
--- a/locale/indigits.h
+++ b/locale/indigits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
diff --git a/locale/indigitswc.h b/locale/indigitswc.h
index 25a49ee7fb..8c5623fb33 100644
--- a/locale/indigitswc.h
+++ b/locale/indigitswc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
diff --git a/locale/iso-4217.def b/locale/iso-4217.def
index bcc170bfb3..414f69bca5 100644
--- a/locale/iso-4217.def
+++ b/locale/iso-4217.def
@@ -162,6 +162,7 @@ DEFINE_INT_CURR("VUV") /* Vanuatu Vatu */
DEFINE_INT_CURR("WST") /* Samoa Tala */
DEFINE_INT_CURR("XAF") /* Central African Franc (United Republic of Cameroon, Central African Republic, Chad, Congo, Gabon) */
DEFINE_INT_CURR("XCD") /* East Caribbean Dollar (Antiqua, Dominica, Grenada, Montserrat, St. Kitts-Nevis-Anguilla, Saint Lucia, Saint Vincent and the Grenadines) */
+DEFINE_INT_CURR("XDR") /* International Monetary Fund */
DEFINE_INT_CURR("XOF") /* West African Franc (Benin, Ivory Coast, Niger, Senegal, Togo, Upper Volta) */
DEFINE_INT_CURR("XPF") /* French polynesia, New Caledonia, Wallis and Futuna Islands */
DEFINE_INT_CURR("YER") /* Yemeni Rial */
diff --git a/locale/iso-639.def b/locale/iso-639.def
index 994792e085..4bea116180 100644
--- a/locale/iso-639.def
+++ b/locale/iso-639.def
@@ -65,6 +65,7 @@ DEFINE_LANGUAGE_CODE ("Belarusian", be, bel, bel)
DEFINE_LANGUAGE_CODE3 ("Bemba", bem, bem)
DEFINE_LANGUAGE_CODE ("Bengali", bn, ben, ben)
DEFINE_LANGUAGE_CODE3 ("Berber (Other)", ber, ber)
+DEFINE_LANGUAGE_CODE3 ("Bhili", bhb, bhb)
DEFINE_LANGUAGE_CODE3 ("Bhojpuri", bho, bho)
DEFINE_LANGUAGE_CODE ("Bihari", bh, bih, bih)
DEFINE_LANGUAGE_CODE3 ("Bikol", bik, bik)
@@ -474,6 +475,7 @@ DEFINE_LANGUAGE_CODE ("Tonga (Tonga Islands)", to, ton, ton)
DEFINE_LANGUAGE_CODE3 ("Tsimshian", tsi, tsi)
DEFINE_LANGUAGE_CODE ("Tsonga", ts, tso, tso)
DEFINE_LANGUAGE_CODE ("Tswana", tn, tsn, tsn)
+DEFINE_LANGUAGE_CODE3 ("Tulu", tcy, tcy)
DEFINE_LANGUAGE_CODE3 ("Tumbuka", tum, tum)
DEFINE_LANGUAGE_CODE3 ("Tupi languages", tup, tup)
DEFINE_LANGUAGE_CODE3 ("Turkish, Ottoman (1500-1928)", ota, ota)
diff --git a/locale/langinfo.h b/locale/langinfo.h
index a0155b50fd..ffc5c7f471 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -1,5 +1,5 @@
/* Access to locale-dependent parameters.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
@@ -255,6 +255,7 @@ enum
_NL_COLLATE_COLLSEQMB,
_NL_COLLATE_COLLSEQWC,
_NL_COLLATE_CODESET,
+ _NL_COLLATE_ENCODING_TYPE,
_NL_NUM_LC_COLLATE,
/* LC_CTYPE category: character classification.
diff --git a/locale/lc-address.c b/locale/lc-address.c
index 9c78bfb4fb..98f1530bd5 100644
--- a/locale/lc-address.c
+++ b/locale/lc-address.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_ADDRESS category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-collate.c b/locale/lc-collate.c
index fdfb8a79b7..abeb7b082b 100644
--- a/locale/lc-collate.c
+++ b/locale/lc-collate.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_COLLATE category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c
index 2a2f48d1cd..564864ea95 100644
--- a/locale/lc-ctype.c
+++ b/locale/lc-ctype.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_CTYPE category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/lc-identification.c b/locale/lc-identification.c
index ebdfe5c4b8..083dbfcb09 100644
--- a/locale/lc-identification.c
+++ b/locale/lc-identification.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_IDENTIFICATION category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-measurement.c b/locale/lc-measurement.c
index fff215a63d..c6fc9c296b 100644
--- a/locale/lc-measurement.c
+++ b/locale/lc-measurement.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_MEASUREMENT category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-messages.c b/locale/lc-messages.c
index de385e4b1b..e9be2610f9 100644
--- a/locale/lc-messages.c
+++ b/locale/lc-messages.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_MESSAGES category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/lc-monetary.c b/locale/lc-monetary.c
index d1eadaec90..65af216bc4 100644
--- a/locale/lc-monetary.c
+++ b/locale/lc-monetary.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_MONETARY category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/lc-name.c b/locale/lc-name.c
index ce3c6f737f..0fa7e6999f 100644
--- a/locale/lc-name.c
+++ b/locale/lc-name.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_NAME category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-numeric.c b/locale/lc-numeric.c
index 68a2c79bf1..f678df2203 100644
--- a/locale/lc-numeric.c
+++ b/locale/lc-numeric.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_NUMERIC category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/lc-paper.c b/locale/lc-paper.c
index 69e00f58c0..2bf1cb076c 100644
--- a/locale/lc-paper.c
+++ b/locale/lc-paper.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_PAPER category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-telephone.c b/locale/lc-telephone.c
index 7db0e9b03d..4b44fcf722 100644
--- a/locale/lc-telephone.c
+++ b/locale/lc-telephone.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_TELEPHONE category.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 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
diff --git a/locale/lc-time.c b/locale/lc-time.c
index 49ffe19c63..c7a34b2973 100644
--- a/locale/lc-time.c
+++ b/locale/lc-time.c
@@ -1,5 +1,5 @@
/* Define current locale data for LC_TIME category.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index e14535e7c0..ce5c21036c 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -1,5 +1,5 @@
/* Code to load locale data from the locale archive file.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
@@ -263,7 +263,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
}
/* If there is no archive or it cannot be loaded for some reason fail. */
- if (__builtin_expect (headmap.ptr == NULL, 0))
+ if (__glibc_unlikely (headmap.ptr == NULL))
goto close_and_out;
/* We have the archive available. To find the name we first have to
@@ -459,11 +459,11 @@ _nl_load_locale_from_archive (int category, const char **namep)
Now we need the expected data structures to point into the data. */
lia = malloc (sizeof *lia);
- if (__builtin_expect (lia == NULL, 0))
+ if (__glibc_unlikely (lia == NULL))
return NULL;
lia->name = strdup (*namep);
- if (__builtin_expect (lia->name == NULL, 0))
+ if (__glibc_unlikely (lia->name == NULL))
{
free (lia);
return NULL;
@@ -478,7 +478,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
lia->data[cnt] = _nl_intern_locale_data (cnt,
results[cnt].addr,
results[cnt].len);
- if (__builtin_expect (lia->data[cnt] != NULL, 1))
+ if (__glibc_likely (lia->data[cnt] != NULL))
{
/* _nl_intern_locale_data leaves us these fields to initialize. */
lia->data[cnt]->alloc = ld_archive;
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index f926036208..fdba6e93c4 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -1,5 +1,5 @@
/* Functions to read locale data files.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -107,7 +107,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
for (cnt = 0; cnt < newdata->nstrings; ++cnt)
{
size_t idx = filedata->strindex[cnt];
- if (__builtin_expect (idx > (size_t) newdata->filesize, 0))
+ if (__glibc_unlikely (idx > (size_t) newdata->filesize))
{
puntdata:
free (newdata);
@@ -183,7 +183,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
close_not_cancel_no_status (fd);
return;
}
- if (__builtin_expect (S_ISDIR (st.st_mode), 0))
+ if (__glibc_unlikely (S_ISDIR (st.st_mode)))
{
/* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo
instead. */
@@ -221,7 +221,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
# endif
filedata = __mmap ((caddr_t) 0, st.st_size,
PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
- if (__builtin_expect (filedata == MAP_FAILED, 0))
+ if (__glibc_unlikely (filedata == MAP_FAILED))
{
filedata = NULL;
if (__builtin_expect (errno, ENOSYS) == ENOSYS)
@@ -258,12 +258,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
/* We have mapped the data, so we no longer need the descriptor. */
close_not_cancel_no_status (fd);
- if (__builtin_expect (filedata == NULL, 0))
+ if (__glibc_unlikely (filedata == NULL))
/* We failed to map or read the data. */
return;
newdata = _nl_intern_locale_data (category, filedata, st.st_size);
- if (__builtin_expect (newdata == NULL, 0))
+ if (__glibc_unlikely (newdata == NULL))
/* Bad data. */
{
#ifdef _POSIX_MAPPED_FILES
diff --git a/locale/locale.h b/locale/locale.h
index 269b61cd2b..76d8b56cbb 100644
--- a/locale/locale.h
+++ b/locale/locale.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/locale/localeconv.c b/locale/localeconv.c
index 3cb2e2b12b..bbbc3bf55c 100644
--- a/locale/localeconv.c
+++ b/locale/localeconv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 070914dd51..bdab9fe745 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -1,5 +1,5 @@
/* Declarations for internal libc locale interfaces
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
@@ -110,6 +110,14 @@ enum coll_sort_rule
sort_mask
};
+/* Collation encoding type. */
+enum collation_encoding_type
+{
+ __cet_other,
+ __cet_8bit,
+ __cet_utf8
+};
+
/* We can map the types of the entries into a few categories. */
enum value_type
{
diff --git a/locale/localename.c b/locale/localename.c
index 7e1a378171..b05b334ff2 100644
--- a/locale/localename.c
+++ b/locale/localename.c
@@ -1,5 +1,5 @@
/* current locale setting names
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/locale/locarchive.h b/locale/locarchive.h
index e00aee46ad..1750ef145f 100644
--- a/locale/locarchive.h
+++ b/locale/locarchive.h
@@ -1,5 +1,5 @@
/* Definitions for locale archive handling.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/locale/mb_cur_max.c b/locale/mb_cur_max.c
index 2a91ac1c1d..77aa7c2a65 100644
--- a/locale/mb_cur_max.c
+++ b/locale/mb_cur_max.c
@@ -1,6 +1,6 @@
/* Return number of characters in multibyte representation for current
character set.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/locale/newlocale.c b/locale/newlocale.c
index 18fb6e2606..b495659e63 100644
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -1,5 +1,5 @@
/* Return a reference to locale information record.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/locale/nl_langinfo.c b/locale/nl_langinfo.c
index f30f12a254..ccd7ea4001 100644
--- a/locale/nl_langinfo.c
+++ b/locale/nl_langinfo.c
@@ -1,5 +1,5 @@
/* User interface for extracting locale-dependent parameters.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/locale/nl_langinfo_l.c b/locale/nl_langinfo_l.c
index b9d02aa8b8..156e09a32f 100644
--- a/locale/nl_langinfo_l.c
+++ b/locale/nl_langinfo_l.c
@@ -1,5 +1,5 @@
/* User interface for extracting locale-dependent parameters.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
@@ -20,6 +20,7 @@
#include <locale.h>
#include <errno.h>
#include <stddef.h>
+#include <stdlib.h>
#include "localeinfo.h"
@@ -43,7 +44,21 @@ __nl_langinfo_l (item, l)
if (index == _NL_ITEM_INDEX (_NL_LOCALE_NAME (category)))
return (char *) l->__names[category];
+#if defined NL_CURRENT_INDIRECT
+ /* Make direct reference to every _nl_current_CATEGORY symbol,
+ since we know only at runtime which categories are used. */
+ switch (category)
+ {
+# define DEFINE_CATEGORY(category, category_name, items, a) \
+ case category: data = *_nl_current_##category; break;
+# include "categories.def"
+# undef DEFINE_CATEGORY
+ default: /* Should be impossible. */
+ abort();
+ }
+#else
data = l->__locales[category];
+#endif
if (index >= data->nstrings)
/* Bogus index for this category: bogus item. */
diff --git a/locale/outdigits.h b/locale/outdigits.h
index 37815f0567..11a1b3367d 100644
--- a/locale/outdigits.h
+++ b/locale/outdigits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
diff --git a/locale/outdigitswc.h b/locale/outdigitswc.h
index b563372ee4..d872903b3b 100644
--- a/locale/outdigitswc.h
+++ b/locale/outdigitswc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
diff --git a/locale/programs/3level.h b/locale/programs/3level.h
index c83cdf205e..5602fd8d88 100644
--- a/locale/programs/3level.h
+++ b/locale/programs/3level.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
index 1317650a10..cf7adea1b5 100644
--- a/locale/programs/charmap-dir.c
+++ b/locale/programs/charmap-dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/programs/charmap-dir.h b/locale/programs/charmap-dir.h
index b586a259f4..33cd062538 100644
--- a/locale/programs/charmap-dir.h
+++ b/locale/programs/charmap-dir.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/programs/charmap-kw.gperf b/locale/programs/charmap-kw.gperf
index cfb5b7c53a..2ce7493aa0 100644
--- a/locale/programs/charmap-kw.gperf
+++ b/locale/programs/charmap-kw.gperf
@@ -1,5 +1,5 @@
%{
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
diff --git a/locale/programs/charmap-kw.h b/locale/programs/charmap-kw.h
index 02ecf4ba36..9a8e5c761f 100644
--- a/locale/programs/charmap-kw.h
+++ b/locale/programs/charmap-kw.h
@@ -30,7 +30,7 @@
#line 1 "charmap-kw.gperf"
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index 1fcce5c327..1685988003 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h
index 1531e02369..08d7e1a623 100644
--- a/locale/programs/charmap.h
+++ b/locale/programs/charmap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/config.h b/locale/programs/config.h
index 18334182d1..b5876a6525 100644
--- a/locale/programs/config.h
+++ b/locale/programs/config.h
@@ -1,5 +1,5 @@
/* Configuration for localedef program.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index 643f081730..0597e11539 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 037fd2fcc5..a39a94f2cc 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -32,6 +32,7 @@
#include "linereader.h"
#include "locfile.h"
#include "elem-hash.h"
+#include "../localeinfo.h"
/* Uncomment the following line in the production version. */
/* #define NDEBUG 1 */
@@ -2130,6 +2131,8 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
/* The words have to be handled specially. */
if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
add_locale_uint32 (&file, 0);
+ else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE))
+ add_locale_uint32 (&file, __cet_other);
else
add_locale_empty (&file);
}
@@ -2493,6 +2496,12 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
add_locale_raw_data (&file, collate->mbseqorder, 256);
add_locale_collseq_table (&file, &collate->wcseqorder);
add_locale_string (&file, charmap->code_set_name);
+ if (strcmp (charmap->code_set_name, "UTF-8") == 0)
+ add_locale_uint32 (&file, __cet_utf8);
+ else if (charmap->mb_cur_max == 1)
+ add_locale_uint32 (&file, __cet_8bit);
+ else
+ add_locale_uint32 (&file, __cet_other);
write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", &file);
obstack_free (&weightpool, NULL);
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 505cb13c54..3f464ef904 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -43,15 +43,6 @@
#include <assert.h>
-#ifdef PREDEFINED_CLASSES
-/* These are the extra bits not in wctype.h since these are not preallocated
- classes. */
-# define _ISwspecial1 (1 << 29)
-# define _ISwspecial2 (1 << 30)
-# define _ISwspecial3 (1 << 31)
-#endif
-
-
/* The bit used for representing a special class. */
#define BITPOS(class) ((class) - tok_upper)
#define BIT(class) (_ISbit (BITPOS (class)))
@@ -114,6 +105,9 @@ struct translit_include_t
struct translit_include_t *next;
};
+/* Provide some dummy pointer for empty string. */
+static uint32_t no_str[] = { 0 };
+
/* Sparse table of uint32_t. */
#define TABLE idx_table
@@ -334,26 +328,6 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
ctype_class_new (lr, ctype, "cntrl");
ctype_class_new (lr, ctype, "punct");
ctype_class_new (lr, ctype, "alnum");
-#ifdef PREDEFINED_CLASSES
- /* The following are extensions from ISO 14652. */
- ctype_class_new (lr, ctype, "left_to_right");
- ctype_class_new (lr, ctype, "right_to_left");
- ctype_class_new (lr, ctype, "num_terminator");
- ctype_class_new (lr, ctype, "num_separator");
- ctype_class_new (lr, ctype, "segment_separator");
- ctype_class_new (lr, ctype, "block_separator");
- ctype_class_new (lr, ctype, "direction_control");
- ctype_class_new (lr, ctype, "sym_swap_layout");
- ctype_class_new (lr, ctype, "char_shape_selector");
- ctype_class_new (lr, ctype, "num_shape_selector");
- ctype_class_new (lr, ctype, "non_spacing");
- ctype_class_new (lr, ctype, "non_spacing_level3");
- ctype_class_new (lr, ctype, "normal_connect");
- ctype_class_new (lr, ctype, "r_connect");
- ctype_class_new (lr, ctype, "no_connect");
- ctype_class_new (lr, ctype, "no_connect-space");
- ctype_class_new (lr, ctype, "vowel_connect");
-#endif
ctype->class_collection_max = charmap->mb_cur_max == 1 ? 256 : 512;
ctype->class_collection
@@ -365,18 +339,13 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
ctype->last_map_idx = MAX_NR_CHARMAP;
ctype_map_new (lr, ctype, "toupper", charmap);
ctype_map_new (lr, ctype, "tolower", charmap);
-#ifdef PREDEFINED_CLASSES
- ctype_map_new (lr, ctype, "tosymmetric", charmap);
-#endif
/* Fill first 256 entries in `toXXX' arrays. */
for (cnt = 0; cnt < 256; ++cnt)
{
ctype->map_collection[0][cnt] = cnt;
ctype->map_collection[1][cnt] = cnt;
-#ifdef PREDEFINED_CLASSES
- ctype->map_collection[2][cnt] = cnt;
-#endif
+
ctype->map256_collection[0][cnt] = cnt;
ctype->map256_collection[1][cnt] = cnt;
}
@@ -1777,7 +1746,7 @@ find_translit2 (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
for (wi = tirunp->from; wi <= wch; wi += tirunp->step)
if (wi == wch)
- return (uint32_t []) { 0 };
+ return no_str;
}
}
@@ -1831,7 +1800,7 @@ read_widestring (struct linereader *ldfile, struct token *now,
if (now->tok == tok_default_missing)
/* The special name "" will denote this case. */
- wstr = ((uint32_t *) { 0 });
+ wstr = no_str;
else if (now->tok == tok_bsymbol)
{
/* Get the value from the repertoire. */
@@ -2266,24 +2235,10 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
break;
if (cnt >= ctype->nr_charclass)
{
-#ifdef PREDEFINED_CLASSES
- if (now->val.str.lenmb == 8
- && memcmp ("special1", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial1;
- else if (now->val.str.lenmb == 8
- && memcmp ("special2", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial2;
- else if (now->val.str.lenmb == 8
- && memcmp ("special3", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial3;
- else
-#endif
- {
- /* OK, it's a new class. */
- ctype_class_new (ldfile, ctype, now->val.str.startmb);
+ /* OK, it's a new class. */
+ ctype_class_new (ldfile, ctype, now->val.str.startmb);
- class_bit = _ISwbit (ctype->nr_charclass - 1);
- }
+ class_bit = _ISwbit (ctype->nr_charclass - 1);
}
else
{
@@ -2871,31 +2826,6 @@ previous definition was here")));
free (now->val.str.startmb);
goto read_mapping;
}
-#ifdef PREDEFINED_CLASSES
- if (strcmp (now->val.str.startmb, "special1") == 0)
- {
- class_bit = _ISwspecial1;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "special2") == 0)
- {
- class_bit = _ISwspecial2;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "special3") == 0)
- {
- class_bit = _ISwspecial3;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "tosymmetric") == 0)
- {
- mapidx = 2;
- goto read_mapping;
- }
-#endif
break;
case tok_end:
@@ -2928,61 +2858,64 @@ previous definition was here")));
}
+/* Subroutine of set_class_defaults, below. */
+static void
+set_one_default (struct locale_ctype_t *ctype,
+ const struct charmap_t *charmap,
+ int bitpos, int from, int to)
+{
+ char tmp[2];
+ int ch;
+ int bit = _ISbit (bitpos);
+ int bitw = _ISwbit (bitpos);
+ /* Define string. */
+ strcpy (tmp, "?");
+
+ for (ch = from; ch <= to; ++ch)
+ {
+ struct charseq *seq;
+ tmp[0] = ch;
+
+ seq = charmap_find_value (charmap, tmp, 1);
+ if (seq == NULL)
+ {
+ char buf[10];
+ sprintf (buf, "U%08X", ch);
+ seq = charmap_find_value (charmap, buf, 9);
+ }
+ if (seq == NULL)
+ {
+ if (!be_quiet)
+ WITH_CUR_LOCALE (error (0, 0, _("\
+%s: character `%s' not defined while needed as default value"),
+ "LC_CTYPE", tmp));
+ }
+ else if (seq->nbytes != 1)
+ WITH_CUR_LOCALE (error (0, 0, _("\
+%s: character `%s' in charmap not representable with one byte"),
+ "LC_CTYPE", tmp));
+ else
+ ctype->class256_collection[seq->bytes[0]] |= bit;
+
+ /* No need to search here, the ASCII value is also the Unicode
+ value. */
+ ELEM (ctype, class_collection, , ch) |= bitw;
+ }
+}
+
static void
set_class_defaults (struct locale_ctype_t *ctype,
const struct charmap_t *charmap,
struct repertoire_t *repertoire)
{
- size_t cnt;
+#define set_default(bitpos, from, to) \
+ set_one_default (ctype, charmap, bitpos, from, to)
/* These function defines the default values for the classes and conversions
according to POSIX.2 2.5.2.1.
It may seem that the order of these if-blocks is arbitrary but it is NOT.
Don't move them unless you know what you do! */
- auto void set_default (int bitpos, int from, int to);
-
- void set_default (int bitpos, int from, int to)
- {
- char tmp[2];
- int ch;
- int bit = _ISbit (bitpos);
- int bitw = _ISwbit (bitpos);
- /* Define string. */
- strcpy (tmp, "?");
-
- for (ch = from; ch <= to; ++ch)
- {
- struct charseq *seq;
- tmp[0] = ch;
-
- seq = charmap_find_value (charmap, tmp, 1);
- if (seq == NULL)
- {
- char buf[10];
- sprintf (buf, "U%08X", ch);
- seq = charmap_find_value (charmap, buf, 9);
- }
- if (seq == NULL)
- {
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", tmp));
- }
- else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", tmp));
- else
- ctype->class256_collection[seq->bytes[0]] |= bit;
-
- /* No need to search here, the ASCII value is also the Unicode
- value. */
- ELEM (ctype, class_collection, , ch) |= bitw;
- }
- }
-
/* Set default values if keyword was not present. */
if ((ctype->class_done & BITw (tok_upper)) == 0)
/* "If this keyword [lower] is not specified, the lowercase letters
@@ -3003,11 +2936,11 @@ set_class_defaults (struct locale_ctype_t *ctype,
unsigned long int mask = BIT (tok_upper) | BIT (tok_lower);
unsigned long int maskw = BITw (tok_upper) | BITw (tok_lower);
- for (cnt = 0; cnt < 256; ++cnt)
+ for (size_t cnt = 0; cnt < 256; ++cnt)
if ((ctype->class256_collection[cnt] & mask) != 0)
ctype->class256_collection[cnt] |= BIT (tok_alpha);
- for (cnt = 0; cnt < ctype->class_collection_act; ++cnt)
+ for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt)
if ((ctype->class_collection[cnt] & maskw) != 0)
ctype->class_collection[cnt] |= BITw (tok_alpha);
}
@@ -3025,11 +2958,11 @@ set_class_defaults (struct locale_ctype_t *ctype,
unsigned long int mask = BIT (tok_alpha) | BIT (tok_digit);
unsigned long int maskw = BITw (tok_alpha) | BITw (tok_digit);
- for (cnt = 0; cnt < 256; ++cnt)
+ for (size_t cnt = 0; cnt < 256; ++cnt)
if ((ctype->class256_collection[cnt] & mask) != 0)
ctype->class256_collection[cnt] |= BIT (tok_alnum);
- for (cnt = 0; cnt < ctype->class_collection_act; ++cnt)
+ for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt)
if ((ctype->class_collection[cnt] & maskw) != 0)
ctype->class_collection[cnt] |= BITw (tok_alnum);
}
@@ -3240,13 +3173,12 @@ set_class_defaults (struct locale_ctype_t *ctype,
unsigned long int maskw = BITw (tok_upper) | BITw (tok_lower) |
BITw (tok_alpha) | BITw (tok_digit) | BITw (tok_xdigit) |
BITw (tok_punct);
- size_t cnt;
- for (cnt = 0; cnt < ctype->class_collection_act; ++cnt)
+ for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt)
if ((ctype->class_collection[cnt] & maskw) != 0)
ctype->class_collection[cnt] |= BITw (tok_graph);
- for (cnt = 0; cnt < 256; ++cnt)
+ for (size_t cnt = 0; cnt < 256; ++cnt)
if ((ctype->class256_collection[cnt] & mask) != 0)
ctype->class256_collection[cnt] |= BIT (tok_graph);
}
@@ -3262,14 +3194,13 @@ set_class_defaults (struct locale_ctype_t *ctype,
unsigned long int maskw = BITw (tok_upper) | BITw (tok_lower) |
BITw (tok_alpha) | BITw (tok_digit) | BITw (tok_xdigit) |
BITw (tok_punct);
- size_t cnt;
struct charseq *seq;
- for (cnt = 0; cnt < ctype->class_collection_act; ++cnt)
+ for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt)
if ((ctype->class_collection[cnt] & maskw) != 0)
ctype->class_collection[cnt] |= BITw (tok_print);
- for (cnt = 0; cnt < 256; ++cnt)
+ for (size_t cnt = 0; cnt < 256; ++cnt)
if ((ctype->class256_collection[cnt] & mask) != 0)
ctype->class256_collection[cnt] |= BIT (tok_print);
@@ -3376,13 +3307,13 @@ set_class_defaults (struct locale_ctype_t *ctype,
/* "If this keyword [tolower] is not specified, the mapping shall be
the reverse mapping of the one specified to `toupper'." [P1003.2] */
{
- for (cnt = 0; cnt < ctype->map_collection_act[0]; ++cnt)
+ for (size_t cnt = 0; cnt < ctype->map_collection_act[0]; ++cnt)
if (ctype->map_collection[0][cnt] != 0)
ELEM (ctype, map_collection, [1],
ctype->map_collection[0][cnt])
= ctype->charnames[cnt];
- for (cnt = 0; cnt < 256; ++cnt)
+ for (size_t cnt = 0; cnt < 256; ++cnt)
if (ctype->map256_collection[0][cnt] != 0)
ctype->map256_collection[1][ctype->map256_collection[0][cnt]] = cnt;
}
@@ -3394,7 +3325,7 @@ set_class_defaults (struct locale_ctype_t *ctype,
%s: field `%s' does not contain exactly ten entries"),
"LC_CTYPE", "outdigit"));
- for (cnt = ctype->outdigits_act; cnt < 10; ++cnt)
+ for (size_t cnt = ctype->outdigits_act; cnt < 10; ++cnt)
{
ctype->mboutdigits[cnt] = charmap_find_symbol (charmap,
(char *) digits + cnt,
@@ -3429,6 +3360,8 @@ no output digits defined and none of the standard names in the charmap")));
ctype->outdigits_act = 10;
}
+
+#undef set_default
}
@@ -3878,76 +3811,72 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
/* Now add the explicitly specified widths. */
if (charmap->width_rules != NULL)
- {
- size_t cnt;
-
- for (cnt = 0; cnt < charmap->nwidth_rules; ++cnt)
- {
- unsigned char bytes[charmap->mb_cur_max];
- int nbytes = charmap->width_rules[cnt].from->nbytes;
-
- /* We have the range of character for which the width is
- specified described using byte sequences of the multibyte
- charset. We have to convert this to UCS4 now. And we
- cannot simply convert the beginning and the end of the
- sequence, we have to iterate over the byte sequence and
- convert it for every single character. */
- memcpy (bytes, charmap->width_rules[cnt].from->bytes, nbytes);
-
- while (nbytes < charmap->width_rules[cnt].to->nbytes
- || memcmp (bytes, charmap->width_rules[cnt].to->bytes,
- nbytes) <= 0)
- {
- /* Find the UCS value for `bytes'. */
- int inner;
- uint32_t wch;
- struct charseq *seq =
- charmap_find_symbol (charmap, (char *) bytes, nbytes);
-
- if (seq == NULL)
- wch = ILLEGAL_CHAR_VALUE;
- else if (seq->ucs4 != UNINITIALIZED_CHAR_VALUE)
- wch = seq->ucs4;
- else
- wch = repertoire_find_value (ctype->repertoire, seq->name,
- strlen (seq->name));
-
- if (wch != ILLEGAL_CHAR_VALUE)
- {
- /* Store the value. */
- uint32_t *class_bits =
- find_idx (ctype, &ctype->class_collection, NULL,
- &ctype->class_collection_act, wch);
-
- if (class_bits != NULL && (*class_bits & BITw (tok_print)))
- wcwidth_table_add (t, wch,
- charmap->width_rules[cnt].width);
- }
-
- /* "Increment" the bytes sequence. */
- inner = nbytes - 1;
- while (inner >= 0 && bytes[inner] == 0xff)
- --inner;
-
- if (inner < 0)
- {
- /* We have to extend the byte sequence. */
- if (nbytes >= charmap->width_rules[cnt].to->nbytes)
- break;
-
- bytes[0] = 1;
- memset (&bytes[1], 0, nbytes);
- ++nbytes;
- }
- else
- {
- ++bytes[inner];
- while (++inner < nbytes)
- bytes[inner] = 0;
- }
- }
- }
- }
+ for (size_t cnt = 0; cnt < charmap->nwidth_rules; ++cnt)
+ {
+ unsigned char bytes[charmap->mb_cur_max];
+ int nbytes = charmap->width_rules[cnt].from->nbytes;
+
+ /* We have the range of character for which the width is
+ specified described using byte sequences of the multibyte
+ charset. We have to convert this to UCS4 now. And we
+ cannot simply convert the beginning and the end of the
+ sequence, we have to iterate over the byte sequence and
+ convert it for every single character. */
+ memcpy (bytes, charmap->width_rules[cnt].from->bytes, nbytes);
+
+ while (nbytes < charmap->width_rules[cnt].to->nbytes
+ || memcmp (bytes, charmap->width_rules[cnt].to->bytes,
+ nbytes) <= 0)
+ {
+ /* Find the UCS value for `bytes'. */
+ int inner;
+ uint32_t wch;
+ struct charseq *seq =
+ charmap_find_symbol (charmap, (char *) bytes, nbytes);
+
+ if (seq == NULL)
+ wch = ILLEGAL_CHAR_VALUE;
+ else if (seq->ucs4 != UNINITIALIZED_CHAR_VALUE)
+ wch = seq->ucs4;
+ else
+ wch = repertoire_find_value (ctype->repertoire, seq->name,
+ strlen (seq->name));
+
+ if (wch != ILLEGAL_CHAR_VALUE)
+ {
+ /* Store the value. */
+ uint32_t *class_bits =
+ find_idx (ctype, &ctype->class_collection, NULL,
+ &ctype->class_collection_act, wch);
+
+ if (class_bits != NULL && (*class_bits & BITw (tok_print)))
+ wcwidth_table_add (t, wch,
+ charmap->width_rules[cnt].width);
+ }
+
+ /* "Increment" the bytes sequence. */
+ inner = nbytes - 1;
+ while (inner >= 0 && bytes[inner] == 0xff)
+ --inner;
+
+ if (inner < 0)
+ {
+ /* We have to extend the byte sequence. */
+ if (nbytes >= charmap->width_rules[cnt].to->nbytes)
+ break;
+
+ bytes[0] = 1;
+ memset (&bytes[1], 0, nbytes);
+ ++nbytes;
+ }
+ else
+ {
+ ++bytes[inner];
+ while (++inner < nbytes)
+ bytes[inner] = 0;
+ }
+ }
+ }
/* Set the width of L'\0' to 0. */
wcwidth_table_add (t, 0, 0);
@@ -3976,7 +3905,6 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
/* First count how many entries we have. This is the upper limit
since some entries from the included files might be overwritten. */
size_t number = 0;
- size_t cnt;
struct translit_t *runp = ctype->translit;
struct translit_t **sorted;
size_t from_len, to_len;
@@ -4036,7 +3964,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
- to-string array.
*/
from_len = to_len = 0;
- for (cnt = 0; cnt < number; ++cnt)
+ for (size_t cnt = 0; cnt < number; ++cnt)
{
struct translit_to_t *srunp;
from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
@@ -4059,7 +3987,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
from_len = 0;
to_len = 0;
- for (cnt = 0; cnt < number; ++cnt)
+ for (size_t cnt = 0; cnt < number; ++cnt)
{
size_t len;
struct translit_to_t *srunp;
@@ -4092,12 +4020,9 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
}
else
{
- /* Provide some dummy pointers since we have nothing to write out. */
- static uint32_t no_str = { 0 };
-
- ctype->translit_from_idx = &no_str;
- ctype->translit_from_tbl = &no_str;
- ctype->translit_to_tbl = &no_str;
+ ctype->translit_from_idx = no_str;
+ ctype->translit_from_tbl = no_str;
+ ctype->translit_to_tbl = no_str;
ctype->translit_idx_size = 0;
ctype->translit_from_tbl_size = 0;
ctype->translit_to_tbl_size = 0;
diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
index 2247b7c38f..7932dc482b 100644
--- a/locale/programs/ld-identification.c
+++ b/locale/programs/ld-identification.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c
index fe54b4be1c..f66197f0db 100644
--- a/locale/programs/ld-measurement.c
+++ b/locale/programs/ld-measurement.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index 591ffaf5be..ec1a80b467 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index 16c8329e77..25270298df 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c
index d409874753..611eede3cf 100644
--- a/locale/programs/ld-name.c
+++ b/locale/programs/ld-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index f2bd597f78..09244c636c 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c
index eec92da671..da4dae450f 100644
--- a/locale/programs/ld-paper.c
+++ b/locale/programs/ld-paper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c
index 4ae241a88f..7e081d8d32 100644
--- a/locale/programs/ld-telephone.c
+++ b/locale/programs/ld-telephone.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index a40edfd474..db490c6cdf 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index d3eb17acc1..2e05130161 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h
index e0b58d1a5c..646915b887 100644
--- a/locale/programs/linereader.h
+++ b/locale/programs/linereader.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
diff --git a/locale/programs/locale-spec.c b/locale/programs/locale-spec.c
index dff344633a..9f1925d47d 100644
--- a/locale/programs/locale-spec.c
+++ b/locale/programs/locale-spec.c
@@ -1,5 +1,5 @@
/* Handle special requests.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 4b3d15a3fd..b1de17f0d2 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,5 +1,5 @@
/* Implementation of the locale program according to POSIX 9945-2.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -295,7 +295,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2014");
+"), "2015");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
@@ -792,188 +792,181 @@ print_assignment (const char *name, const char *val, bool dquote)
static void
show_locale_vars (void)
{
- size_t cat_no;
- const char *lcall = getenv ("LC_ALL") ? : "";
- const char *lang = getenv ("LANG") ? : "";
-
- auto void get_source (const char *name);
-
- void get_source (const char *name)
- {
- char *val = getenv (name);
-
- if (lcall[0] != '\0' || val == NULL)
- print_assignment (name, lcall[0] ? lcall : lang[0] ? lang : "POSIX",
- true);
- else
- print_assignment (name, val, false);
- }
+ const char *lcall = getenv ("LC_ALL") ?: "";
+ const char *lang = getenv ("LANG") ?: "";
/* LANG has to be the first value. */
print_assignment ("LANG", lang, false);
/* Now all categories in an unspecified order. */
- for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
+ for (size_t cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
if (cat_no != LC_ALL)
- get_source (category[cat_no].name);
+ {
+ const char *name = category[cat_no].name;
+ const char *val = getenv (name);
+
+ if (lcall[0] != '\0' || val == NULL)
+ print_assignment (name,
+ lcall[0] != '\0' ? lcall
+ : lang[0] != '\0' ? lang
+ : "POSIX",
+ true);
+ else
+ print_assignment (name, val, false);
+ }
/* The last is the LC_ALL value. */
print_assignment ("LC_ALL", lcall, false);
}
-/* Show the information request for NAME. */
+/* Subroutine of show_info, below. */
static void
-show_info (const char *name)
+print_item (struct cat_item *item)
{
- size_t cat_no;
-
- auto void print_item (struct cat_item *item);
-
- void print_item (struct cat_item *item)
+ switch (item->value_type)
{
- switch (item->value_type)
- {
- case string:
- if (show_keyword_name)
- printf ("%s=\"", item->name);
- fputs (nl_langinfo (item->item_id) ? : "", stdout);
- if (show_keyword_name)
- putchar ('"');
- putchar ('\n');
- break;
- case stringarray:
- {
- int cnt;
- const char *val;
-
- if (show_keyword_name)
- printf ("%s=\"", item->name);
+ case string:
+ if (show_keyword_name)
+ printf ("%s=\"", item->name);
+ fputs (nl_langinfo (item->item_id) ? : "", stdout);
+ if (show_keyword_name)
+ putchar ('"');
+ putchar ('\n');
+ break;
+ case stringarray:
+ {
+ const char *val;
+ int cnt;
- for (cnt = 0; cnt < item->max - 1; ++cnt)
- {
- val = nl_langinfo (item->item_id + cnt);
- if (val != NULL)
- fputs (val, stdout);
- putchar (';');
- }
+ if (show_keyword_name)
+ printf ("%s=\"", item->name);
+ for (cnt = 0; cnt < item->max - 1; ++cnt)
+ {
val = nl_langinfo (item->item_id + cnt);
if (val != NULL)
fputs (val, stdout);
-
- if (show_keyword_name)
- putchar ('"');
- putchar ('\n');
+ putchar (';');
}
- break;
- case stringlist:
+
+ val = nl_langinfo (item->item_id + cnt);
+ if (val != NULL)
+ fputs (val, stdout);
+
+ if (show_keyword_name)
+ putchar ('"');
+ putchar ('\n');
+ }
+ break;
+ case stringlist:
+ {
+ int first = 1;
+ const char *val = nl_langinfo (item->item_id) ? : "";
+
+ if (show_keyword_name)
+ printf ("%s=", item->name);
+
+ for (int cnt = 0; cnt < item->max && *val != '\0'; ++cnt)
{
- int first = 1;
- const char *val = nl_langinfo (item->item_id) ? : "";
- int cnt;
-
- if (show_keyword_name)
- printf ("%s=", item->name);
-
- for (cnt = 0; cnt < item->max && *val != '\0'; ++cnt)
- {
- printf ("%s%s%s%s", first ? "" : ";",
- show_keyword_name ? "\"" : "", val,
- show_keyword_name ? "\"" : "");
- val = strchr (val, '\0') + 1;
- first = 0;
- }
- putchar ('\n');
+ printf ("%s%s%s%s", first ? "" : ";",
+ show_keyword_name ? "\"" : "", val,
+ show_keyword_name ? "\"" : "");
+ val = strchr (val, '\0') + 1;
+ first = 0;
}
- break;
- case byte:
- {
- const char *val = nl_langinfo (item->item_id);
+ putchar ('\n');
+ }
+ break;
+ case byte:
+ {
+ const char *val = nl_langinfo (item->item_id);
- if (show_keyword_name)
- printf ("%s=", item->name);
+ if (show_keyword_name)
+ printf ("%s=", item->name);
- if (val != NULL)
- printf ("%d", *val == '\377' ? -1 : *val);
- putchar ('\n');
- }
- break;
- case bytearray:
+ if (val != NULL)
+ printf ("%d", *val == '\377' ? -1 : *val);
+ putchar ('\n');
+ }
+ break;
+ case bytearray:
+ {
+ const char *val = nl_langinfo (item->item_id);
+ int cnt = val ? strlen (val) : 0;
+
+ if (show_keyword_name)
+ printf ("%s=", item->name);
+
+ while (cnt > 1)
{
- const char *val = nl_langinfo (item->item_id);
- int cnt = val ? strlen (val) : 0;
+ printf ("%d;", *val == '\177' ? -1 : *val);
+ --cnt;
+ ++val;
+ }
- if (show_keyword_name)
- printf ("%s=", item->name);
+ printf ("%d\n", cnt == 0 || *val == '\177' ? -1 : *val);
+ }
+ break;
+ case word:
+ {
+ union { unsigned int word; char *string; } val;
+ val.string = nl_langinfo (item->item_id);
+ if (show_keyword_name)
+ printf ("%s=", item->name);
- while (cnt > 1)
- {
- printf ("%d;", *val == '\177' ? -1 : *val);
- --cnt;
- ++val;
- }
+ printf ("%d\n", val.word);
+ }
+ break;
+ case wordarray:
+ {
+ int first = 1;
+ union { unsigned int *wordarray; char *string; } val;
- printf ("%d\n", cnt == 0 || *val == '\177' ? -1 : *val);
- }
- break;
- case word:
- {
- union { unsigned int word; char *string; } val;
- val.string = nl_langinfo (item->item_id);
- if (show_keyword_name)
- printf ("%s=", item->name);
+ val.string = nl_langinfo (item->item_id);
+ if (show_keyword_name)
+ printf ("%s=", item->name);
- printf ("%d\n", val.word);
- }
- break;
- case wordarray:
+ for (int cnt = 0; cnt < item->max; ++cnt)
{
- int first = 1;
- union { unsigned int *wordarray; char *string; } val;
- int cnt;
-
- val.string = nl_langinfo (item->item_id);
- if (show_keyword_name)
- printf ("%s=", item->name);
-
- for (cnt = 0; cnt < item->max; ++cnt)
- {
- printf ("%s%d", first ? "" : ";", val.wordarray[cnt]);
- first = 0;
- }
- putchar ('\n');
+ printf ("%s%d", first ? "" : ";", val.wordarray[cnt]);
+ first = 0;
}
- break;
- case wstring:
- case wstringarray:
- case wstringlist:
- /* We don't print wide character information since the same
- information is available in a multibyte string. */
- default:
- break;
-
- }
+ putchar ('\n');
+ }
+ break;
+ case wstring:
+ case wstringarray:
+ case wstringlist:
+ /* We don't print wide character information since the same
+ information is available in a multibyte string. */
+ default:
+ break;
}
+}
- for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
+/* Show the information request for NAME. */
+static void
+show_info (const char *name)
+{
+ for (size_t cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
if (cat_no != LC_ALL)
{
- size_t item_no;
-
if (strcmp (name, category[cat_no].name) == 0)
/* Print the whole category. */
{
if (show_category_name != 0)
puts (category[cat_no].name);
- for (item_no = 0; item_no < category[cat_no].number; ++item_no)
+ for (size_t item_no = 0;
+ item_no < category[cat_no].number;
+ ++item_no)
print_item (&category[cat_no].item_desc[item_no]);
return;
}
- for (item_no = 0; item_no < category[cat_no].number; ++item_no)
+ for (size_t item_no = 0; item_no < category[cat_no].number; ++item_no)
if (strcmp (name, category[cat_no].item_desc[item_no].name) == 0)
{
if (show_category_name != 0)
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 97af5e77c3..2a0f2aa709 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -403,7 +403,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2014");
+"), "2015");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
index 5cdeabdcda..7e19ff0604 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -1,5 +1,5 @@
/* General definitions for localedef(1).
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index cdd99602c2..49f7f1b3cf 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf
index 71adc10fba..ab40f28d93 100644
--- a/locale/programs/locfile-kw.gperf
+++ b/locale/programs/locfile-kw.gperf
@@ -1,5 +1,5 @@
%{
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h
index 727df05cda..0978861eed 100644
--- a/locale/programs/locfile-kw.h
+++ b/locale/programs/locfile-kw.h
@@ -30,7 +30,7 @@
#line 1 "locfile-kw.gperf"
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h
index d8859aebd8..10c9907b1f 100644
--- a/locale/programs/locfile-token.h
+++ b/locale/programs/locfile-token.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index de6b426f0c..33da52e1ee 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -84,7 +84,7 @@ locfile_read (struct localedef_t *result, const struct charmap_t *charmap)
if (ldfile == NULL)
{
- stpcpy (stpcpy (path, next), filename);
+ stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
ldfile = lr_open (path, locfile_hash);
}
diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
index b579a4626c..6fc441b2d8 100644
--- a/locale/programs/locfile.h
+++ b/locale/programs/locfile.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -81,7 +81,8 @@ set_big_endian (bool big_endian)
/* Munge VALUE so that, when stored, it has the correct byte order
for the output files. */
-static inline uint32_t
+static uint32_t
+__attribute__ ((unused))
maybe_swap_uint32 (uint32_t value)
{
return swap_endianness_p ? bswap_32 (value) : value;
diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c
index 28e4bcc15f..e7b41eb7c7 100644
--- a/locale/programs/repertoire.c
+++ b/locale/programs/repertoire.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -96,7 +96,7 @@ repertoire_read (const char *filename)
if (repfile == NULL)
{
- stpcpy (stpcpy (path, next), filename);
+ stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
repfile = lr_open (path, repertoiremap_hash);
}
diff --git a/locale/programs/repertoire.h b/locale/programs/repertoire.h
index 05d0cbc094..559e127a07 100644
--- a/locale/programs/repertoire.h
+++ b/locale/programs/repertoire.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index ef371a080c..a4412f9787 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -1,5 +1,5 @@
/* Implement simple hashing table with string based keys.
- Copyright (C) 1994-2014 Free Software Foundation, Inc.
+ Copyright (C) 1994-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
@@ -27,11 +27,7 @@
#include <stdint.h>
#include <sys/types.h>
-#if HAVE_OBSTACK
-# include <obstack.h>
-#else
-# include "obstack.h"
-#endif
+#include <obstack.h>
#ifdef HAVE_VALUES_H
# include <values.h>
@@ -46,10 +42,6 @@
# define BITSPERBYTE 8
#endif
-#ifndef bcopy
-# define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-
#define hashval_t uint32_t
#include "hashval.h"
diff --git a/locale/programs/simple-hash.h b/locale/programs/simple-hash.h
index cd85290c0c..a7f97769a8 100644
--- a/locale/programs/simple-hash.h
+++ b/locale/programs/simple-hash.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/xmalloc.c b/locale/programs/xmalloc.c
index 361c2b49f6..36bc17fe89 100644
--- a/locale/programs/xmalloc.c
+++ b/locale/programs/xmalloc.c
@@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/programs/xstrdup.c b/locale/programs/xstrdup.c
index f8dc00a5d4..a8fadb3d15 100644
--- a/locale/programs/xstrdup.c
+++ b/locale/programs/xstrdup.c
@@ -1,5 +1,5 @@
/* xstrdup.c -- copy a string with out of memory checking
- Copyright (C) 1990-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/setlocale.c b/locale/setlocale.c
index b70fa6cbce..fa9cb3a1d6 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -272,16 +272,24 @@ setlocale (int category, const char *locale)
of entries of the form `CATEGORY=VALUE'. */
const char *newnames[__LC_LAST];
struct __locale_data *newdata[__LC_LAST];
+ /* Copy of the locale argument, for in-place splitting. */
+ char *locale_copy = NULL;
/* Set all name pointers to the argument name. */
for (category = 0; category < __LC_LAST; ++category)
if (category != LC_ALL)
newnames[category] = (char *) locale;
- if (__builtin_expect (strchr (locale, ';') != NULL, 0))
+ if (__glibc_unlikely (strchr (locale, ';') != NULL))
{
/* This is a composite name. Make a copy and split it up. */
- char *np = strdupa (locale);
+ locale_copy = strdup (locale);
+ if (__glibc_unlikely (locale_copy == NULL))
+ {
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ return NULL;
+ }
+ char *np = locale_copy;
char *cp;
int cnt;
@@ -299,6 +307,7 @@ setlocale (int category, const char *locale)
{
error_return:
__libc_rwlock_unlock (__libc_setlocale_lock);
+ free (locale_copy);
/* Bogus category name. */
ERROR_RETURN;
@@ -391,8 +400,9 @@ setlocale (int category, const char *locale)
/* Critical section left. */
__libc_rwlock_unlock (__libc_setlocale_lock);
- /* Free the resources (the locale path variable). */
+ /* Free the resources. */
free (locale_path);
+ free (locale_copy);
return composite;
}
diff --git a/locale/strlen-hash.h b/locale/strlen-hash.h
index b161f2d649..181fbc08b5 100644
--- a/locale/strlen-hash.h
+++ b/locale/strlen-hash.h
@@ -1,5 +1,5 @@
/* Implements hashing function for string with known length.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/locale/tst-C-locale.c b/locale/tst-C-locale.c
index afe4dc9a88..12d5e254b8 100644
--- a/locale/tst-C-locale.c
+++ b/locale/tst-C-locale.c
@@ -1,5 +1,5 @@
/* Tests of C and POSIX locale contents.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
diff --git a/locale/uselocale.c b/locale/uselocale.c
index b9114cdf0d..5b253bd5b5 100644
--- a/locale/uselocale.c
+++ b/locale/uselocale.c
@@ -1,5 +1,5 @@
/* uselocale -- fetch and set the current per-thread locale
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/locale/weight.h b/locale/weight.h
index 9eb8ac666a..721bf7dabf 100644
--- a/locale/weight.h
+++ b/locale/weight.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper, <drepper@cygnus.com>.
@@ -16,10 +16,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#ifndef _WEIGHT_H_
+#define _WEIGHT_H_ 1
+
/* Find index of weight. */
-auto inline int32_t
-__attribute ((always_inline))
-findidx (const unsigned char **cpp, size_t len)
+static inline int32_t __attribute__ ((always_inline))
+findidx (const int32_t *table,
+ const int32_t *indirect,
+ const unsigned char *extra,
+ const unsigned char **cpp, size_t len)
{
int_fast32_t i = table[*(*cpp)++];
const unsigned char *cp;
@@ -130,3 +135,5 @@ findidx (const unsigned char **cpp, size_t len)
/* NOTREACHED */
return 0x43219876;
}
+
+#endif /* weight.h */
diff --git a/locale/weightwc.h b/locale/weightwc.h
index 8f047e3ba7..3cd7a69845 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper, <drepper@cygnus.com>.
@@ -16,10 +16,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#ifndef _WEIGHTWC_H_
+#define _WEIGHTWC_H_ 1
+
/* Find index of weight. */
-auto inline int32_t
-__attribute ((always_inline))
-findidx (const wint_t **cpp, size_t len)
+static inline int32_t __attribute__ ((always_inline))
+findidx (const int32_t *table,
+ const int32_t *indirect,
+ const wint_t *extra,
+ const wint_t **cpp, size_t len)
{
wint_t ch = *(*cpp)++;
int32_t i = __collidx_table_lookup ((const char *) table, ch);
@@ -109,3 +114,5 @@ findidx (const wint_t **cpp, size_t len)
/* NOTREACHED */
return 0x43219876;
}
+
+#endif /* weightwc.h */
diff --git a/locale/xlocale.c b/locale/xlocale.c
index 67ee392afa..fec4564702 100644
--- a/locale/xlocale.c
+++ b/locale/xlocale.c
@@ -1,5 +1,5 @@
/* C locale object.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
diff --git a/locale/xlocale.h b/locale/xlocale.h
index f58208fe6f..f920874855 100644
--- a/locale/xlocale.h
+++ b/locale/xlocale.h
@@ -1,5 +1,5 @@
/* Definition of locale datatype.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.