summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2021-12-16 09:55:20 +0100
committerMarc Mutz <marc.mutz@qt.io>2021-12-17 03:20:22 +0100
commitdc1c0536bb3d82b1d2c22325ba9480aec6a68833 (patch)
treeeb79a318365a9d02cadac2d668c4237ec192f815 /src/corelib/text/qbytearray.cpp
parent572b55baa42787447643169811784bc64024fb5e (diff)
QByteArray: optimize replace() a bit
These days, we perform the alias check unconditionally, so the remainder of the function can assume that *this and after do not overlap. So memcpy() suffices, we don't need memmove(). Pick-to: 6.3 6.2 Change-Id: Ib6966facfe643b0aaf50d902709f5fe926bed527 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r--src/corelib/text/qbytearray.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index c45ae1f8e4..7562548bad 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -2170,7 +2170,7 @@ QByteArray &QByteArray::replace(qsizetype pos, qsizetype len, QByteArrayView aft
}
if (len == after.size() && (pos + len <= size())) {
detach();
- memmove(d.data() + pos, after.data(), len*sizeof(char));
+ memcpy(d.data() + pos, after.data(), len*sizeof(char));
return *this;
} else {
// ### optimize me