From def9790d51a51a78a700567bb677225a90bc854e Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Sat, 15 Dec 2001 07:05:04 +0000 Subject: Clean up initialization and simplfy caching of underlying "C" locale objects. 2001-12-14 Benjamin Kosnik Clean up initialization and simplfy caching of underlying "C" locale objects. * src/localename.cc (locale::_Impl::_Impl(string, size_t): Unconditionally create __clocale object for all named locales, including "C" and "POSIX". * config/locale/c_locale_generic.cc (locale::facet::_S_create_c_locale): Always set __cloc to zero. * config/locale/c_locale_gnu.cc: Always delete. * include/bits/localefwd.h (locale::facet::_S_c_locale): New. * src/locale.cc (locale::classic()): Initialize locale::facet::_S_c_locale. (locale::facet::_S_c_locale): Define. * include/bits/locale_facets.h: Add ctype_byname ctor specialization. * src/locale.cc: Add definition here. * config/os/gnu-linux/bits/ctype_inline.h: Tweak. * config/os/gnu-linux/bits/ctype_noninline.h: Adjust initializations. * include/bits/locale_facets.h (ctype::_M_c_locale_ctype): Add. Adjust ctors, dtors. (ctype::_M_toupper): Remove const&. (ctype::_M_tolower): Remove const&. (ctype::_M_ctable): Remove const&. * include/bits/locale_facets.h (collate): Clean up initialization of _M_c_locale_collate in ctors and dtors. * config/locale/collate_members_gnu.cc: Always use extended functions. * include/bits/locale_facets.h (messages): Clean up inits in ctor/dtor. (messages_byname): Same. * config/locale/messages_members_generic.h (messages::~messages): Remove. * config/locale/messages_members_gnu.h: Same. * include/bits/localefwd.h: Clean. Move dtor definitions to * src/locale.cc: Here. * testsuite/22_locale/facet.cc: Fix spelling. Named locale support for ctype. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add variable ctype_members_* bits. * aclocal.m4: Regenerate. * configure: Regenerate. * src/Makefile.am (sources): Add ctype.cc. * src/Makefile.in: Regenerate. * config/locale/ctype_members_generic.cc: New file. * config/locale/ctype_members_gnu.cc: New file. * src/locale.cc: Remove ctype definitions. From-SVN: r48034 --- libstdc++-v3/include/bits/localefwd.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libstdc++-v3/include/bits/localefwd.h') diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h index af48b60..a0fe324 100644 --- a/libstdc++-v3/include/bits/localefwd.h +++ b/libstdc++-v3/include/bits/localefwd.h @@ -282,7 +282,10 @@ namespace std static inline void _S_initialize() - { if (!_S_classic) classic(); } + { + if (!_S_classic) + classic(); + } static category _S_normalize_category(category); @@ -344,7 +347,7 @@ namespace std _Impl(string __name, size_t); ~_Impl() throw(); - bool + inline bool _M_check_same_name() { bool __ret = true; @@ -352,6 +355,7 @@ namespace std __ret &= _M_names[i] == _M_names[i + 1]; return __ret; } + void _M_replace_categories(const _Impl*, category); @@ -387,11 +391,15 @@ namespace std friend class __enc_traits; protected: + // Contains data from the underlying "C" library for default "C" + // and "POSIX" locales. + static __c_locale _S_c_locale; + explicit facet(size_t __refs = 0) throw(); virtual - ~facet() { }; + ~facet(); static void _S_create_c_locale(__c_locale& __cloc, const char* __s); @@ -447,8 +455,7 @@ namespace std public: // NB: This class is always a static data member, and thus can be // counted on to be zero-initialized. - // XXX id() : _M_index(0) { } - id() { } + id(); }; template -- cgit v1.1