* @brief Allocation-free QString copy: reuses the destination buffer when it is unique and * large enough, falling back to an implicit-share assignment otherwise. */
| 876 | * large enough, falling back to an implicit-share assignment otherwise. |
| 877 | */ |
| 878 | SS_FORCE_INLINE void assign_string_in_place(QString& dst, const QString& src) noexcept |
| 879 | { |
| 880 | const qsizetype n = src.size(); |
| 881 | if (dst.isDetached() && dst.capacity() >= n) { |
| 882 | dst.resize(n); |
| 883 | if (n > 0) |
| 884 | memcpy(dst.data(), src.constData(), static_cast<size_t>(n) * sizeof(QChar)); |
| 885 | } else |
| 886 | dst = src; |
| 887 | } |
| 888 | |
| 889 | /** |
| 890 | * @brief Writes UTF-8 bytes into a QString, reusing the destination buffer for ASCII payloads. The |
no test coverage detected