summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2020-09-10 14:11:27 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2020-09-14 09:47:50 +0200
commit1ca3af0a71f1df4f3fe5940b177bb8afac1e208d (patch)
tree85456b428ed285956b259598b6ff9aa7acc02efd
parent184e385aa2c64df525c83c71a7ff4eee4ff06b1f (diff)
QString: use QCommonArrayOps::erase instead of custom logic
With 6e8985e3576a4439bd66c0767f9912d1e124682c merged we can now use generic erase logic provided by array operations. This commit aligns QString with QList/QByteArray Task-number: QTBUG-84320 Change-Id: I83e9349e2461afd98737df25613aa2d0fd817a71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/text/qstring.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index f34a100747..18ac05a41b 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -2974,10 +2974,8 @@ QString &QString::remove(qsizetype pos, qsizetype len)
resize(pos); // truncate
} else if (len > 0) {
detach();
- memmove(d.data() + pos, d.data() + pos + len,
- (d.size - pos - len) * sizeof(QChar));
- d.size -= len;
- d.data()[d.size] = '\0';
+ d->erase(d.begin() + pos, d.begin() + pos + len);
+ d.data()[d.size] = u'\0';
}
return *this;
}