diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-10-09 13:55:39 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-10-09 13:55:39 +0100 |
commit | 531b0a3172ed423175d7ebbf317cd79f4613735e (patch) | |
tree | ea115aff2c93ab9bcdb6630379d3bde014953159 | |
parent | 6bbead0c5afef2752cd6a6b55208d738f65c95a6 (diff) | |
download | gcc-531b0a3172ed423175d7ebbf317cd79f4613735e.zip gcc-531b0a3172ed423175d7ebbf317cd79f4613735e.tar.gz gcc-531b0a3172ed423175d7ebbf317cd79f4613735e.tar.bz2 |
PR libstdc++/78552 only construct std::locale for C locale once
PR libstdc++/78552
* src/c++98/locale_init.cc (locale::classic()): Do not construct a new
locale object for every call.
(locale::_S_initialize_once()): Construct C locale here.
From-SVN: r276758
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/src/c++98/locale_init.cc | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7f08a55..47f0ce8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2019-10-09 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/78552 + * src/c++98/locale_init.cc (locale::classic()): Do not construct a new + locale object for every call. + (locale::_S_initialize_once()): Construct C locale here. + 2019-10-08 Jonathan Wakely <jwakely@redhat.com> * doc/Makefile.am (doc-html-docbook-regenerate): New target. diff --git a/libstdc++-v3/src/c++98/locale_init.cc b/libstdc++-v3/src/c++98/locale_init.cc index e5e9d74..07d95dc 100644 --- a/libstdc++-v3/src/c++98/locale_init.cc +++ b/libstdc++-v3/src/c++98/locale_init.cc @@ -303,7 +303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION locale::classic() { _S_initialize(); - return *(new (&c_locale) locale(_S_classic)); + return *(const locale*)c_locale; } void @@ -313,6 +313,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // One reference for _S_classic, one for _S_global _S_classic = new (&c_locale_impl) _Impl(2); _S_global = _S_classic; + new (&c_locale) locale(_S_classic); } void |