]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Replace global std::string objects in tzdb.cc
authorJonathan Wakely <jwakely@redhat.com>
Thu, 17 Aug 2023 19:39:02 +0000 (20:39 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 17 Aug 2023 19:42:35 +0000 (20:42 +0100)
commitd82a85b6161cbeebfe3de5d3d4cdd355e4617e69
treefafda9687e0d7125fc2d64838fa870cc7fbc3f49
parentaad83d61d2e92b168688f7b6bd00b8604d11fc9f
libstdc++: Replace global std::string objects in tzdb.cc

When the library is built with --disable-libstdcxx-dual-abi the only
type of std::string supported is the COW string, and the two global
std::string objects in tzdb.cc have to allocate memory. I added them
thinking they would fit in the SSO string buffer, but that's not the
case when the library only uses COW strings.

Replace them with string_view objects to avoid any allocations.

libstdc++-v3/ChangeLog:

* src/c++20/tzdb.cc (tzdata_file, leaps_file): Change type to
std::string_view.
libstdc++-v3/src/c++20/tzdb.cc