From: Jonathan Wakely Date: Thu, 17 Mar 2022 14:36:07 +0000 (+0000) Subject: libstdc++: Avoid including in [PR92546] X-Git-Tag: upstream/12.2.0~1006 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00df7ee4474faca91d3460fe78a88e280c6c1126;p=platform%2Fupstream%2Fgcc.git libstdc++: Avoid including in [PR92546] This only affects Windows, but reduces the preprocessed size of significantly. libstdc++-v3/ChangeLog: PR libstdc++/92546 * include/bits/fs_path.h (path::make_preferred): Use handwritten loop instead of std::replace. --- diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index b16a878..9e06fa6 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -52,7 +52,6 @@ #if defined(_WIN32) && !defined(__CYGWIN__) # define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 -# include #endif namespace std _GLIBCXX_VISIBILITY(default) @@ -1060,8 +1059,12 @@ namespace __detail path::make_preferred() { #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - std::replace(_M_pathname.begin(), _M_pathname.end(), L'/', - preferred_separator); + auto __pos = _M_pathname.find(L'/'); + while (__pos != _M_pathname.npos) + { + _M_pathname[__pos] = preferred_separator; + __pos = _M_pathname.find(L'/', __pos); + } #endif return *this; }