qt6-bb10/tests/auto/corelib/text/qstring
Ahmad Samir eb60e94020 QString: don't detach in replace_helper()
I.e. don't detach in the replace() overloads that delegate to
replace_helper() if this string is shared, instead create a new string
and copy characters from this string to it, along with the "after"
string, then swap it with this.

Do the same thing if "before" is shorter than "after" and there isn't
enough capacity to do the replacement without reallocating.

Use std::copy* and std::move*, which will both fallback to
memmove/memcpy, but they have C++ API, which is more readable.

[ChangeLog][QtCore][QString] Using replace() on a currently shared
QString is now done more efficiently

Task-number: QTBUG-106184
Change-Id: If74ffa1ed47636dc23d543d6dc123d8f2b21d537
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 22:52:01 +02:00
..
.gitignore Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
CMakeLists.txt Add QString<->emscripten::val conversion functions 2023-01-13 21:07:14 +01:00
double_data.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
tst_qstring.cpp QString: don't detach in replace_helper() 2023-02-09 22:52:01 +02:00
tst_qstring_mac.mm Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h 2022-09-01 13:26:30 +02:00
tst_qstring_wasm.cpp Add QString<->emscripten::val conversion functions 2023-01-13 21:07:14 +01:00