From: Jonathan Wakely Date: Sat, 29 Nov 2014 22:58:38 +0000 (+0000) Subject: locale_init.cc (locale::_Impl::_Impl(size_t)): Use new-initializer instead of loop. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38dbb2a53f393a9ee895cf6247a900cbb1cc8be2;p=gcc.git locale_init.cc (locale::_Impl::_Impl(size_t)): Use new-initializer instead of loop. * src/c++98/locale_init.cc (locale::_Impl::_Impl(size_t)): Use new-initializer instead of loop. * src/c++98/localename.cc (locale::_Impl::_Impl(const char*, size_t)): Likewise. From-SVN: r218184 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5781709284d..ac4d4a43f77 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -4,6 +4,11 @@ typedef. (time_get): Likewise. Fix comments. + * src/c++98/locale_init.cc (locale::_Impl::_Impl(size_t)): Use + new-initializer instead of loop. + * src/c++98/localename.cc (locale::_Impl::_Impl(const char*, size_t)): + Likewise. + 2014-11-26 Jonathan Wakely Rainer Orth diff --git a/libstdc++-v3/src/c++98/locale_init.cc b/libstdc++-v3/src/c++98/locale_init.cc index 2c6dfc53ec5..c007648d37b 100644 --- a/libstdc++-v3/src/c++98/locale_init.cc +++ b/libstdc++-v3/src/c++98/locale_init.cc @@ -375,17 +375,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS), _M_caches(0), _M_names(0) { - _M_facets = new (&facet_vec) const facet*[_M_facets_size]; - _M_caches = new (&cache_vec) const facet*[_M_facets_size]; - for (size_t __i = 0; __i < _M_facets_size; ++__i) - _M_facets[__i] = _M_caches[__i] = 0; + _M_facets = new (&facet_vec) const facet*[_M_facets_size](); + _M_caches = new (&cache_vec) const facet*[_M_facets_size](); // Name the categories. - _M_names = new (&name_vec) char*[_S_categories_size]; + _M_names = new (&name_vec) char*[_S_categories_size](); _M_names[0] = new (&name_c[0]) char[2]; std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2); - for (size_t __j = 1; __j < _S_categories_size; ++__j) - _M_names[__j] = 0; // This is needed as presently the C++ version of "C" locales // != data in the underlying locale model for __timepunct, diff --git a/libstdc++-v3/src/c++98/localename.cc b/libstdc++-v3/src/c++98/localename.cc index e93c846e784..589f8c6617d 100644 --- a/libstdc++-v3/src/c++98/localename.cc +++ b/libstdc++-v3/src/c++98/localename.cc @@ -184,15 +184,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __try { - _M_facets = new const facet*[_M_facets_size]; - for (size_t __i = 0; __i < _M_facets_size; ++__i) - _M_facets[__i] = 0; - _M_caches = new const facet*[_M_facets_size]; - for (size_t __j = 0; __j < _M_facets_size; ++__j) - _M_caches[__j] = 0; - _M_names = new char*[_S_categories_size]; - for (size_t __k = 0; __k < _S_categories_size; ++__k) - _M_names[__k] = 0; + _M_facets = new const facet*[_M_facets_size](); + _M_caches = new const facet*[_M_facets_size](); + _M_names = new char*[_S_categories_size](); // Name the categories. const char* __smon = __s;