diff options
-rw-r--r-- | src/corelib/tools/qstring.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 5 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 6935c76b42..c5c43673bc 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1330,11 +1330,6 @@ void QString::realloc(int alloc) } } -void QString::realloc() -{ - realloc(d->size); -} - void QString::expand(int i) { int sz = d->size; @@ -2823,7 +2818,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after) if (isEmpty() && rx2.indexIn(*this) == -1) return *this; - realloc(); + realloc(d->size); int index = 0; int numCaptures = rx2.captureCount(); @@ -2986,7 +2981,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) if (!iterator.hasNext()) // no matches at all return *this; - realloc(); + realloc(d->size); int numCaptures = re.captureCount(); @@ -5088,8 +5083,10 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, const ushort *QString::utf16() const { - if (IS_RAW_DATA(d)) - const_cast<QString*>(this)->realloc(); // ensure '\\0'-termination for ::fromRawData strings + if (IS_RAW_DATA(d)) { + // ensure '\0'-termination for ::fromRawData strings + const_cast<QString*>(this)->realloc(d->size); + } return d->data(); } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 202b74dfbf..fd22eb78a8 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -651,7 +651,6 @@ private: static int grow(int); static void free(Data *); - void realloc(); void realloc(int alloc); void expand(int i); void updateProperties() const; @@ -748,7 +747,7 @@ inline QChar *QString::data() inline const QChar *QString::constData() const { return reinterpret_cast<const QChar*>(d->data()); } inline void QString::detach() -{ if (d->ref.isShared() || (d->offset != sizeof(QStringData))) realloc(); } +{ if (d->ref.isShared() || (d->offset != sizeof(QStringData))) realloc(d->size); } inline bool QString::isDetached() const { return !d->ref.isShared(); } inline QString &QString::operator=(const QLatin1String &s) @@ -925,7 +924,7 @@ inline void QString::reserve(int asize) inline void QString::squeeze() { if (d->ref.isShared() || d->size < int(d->alloc)) - realloc(); + realloc(d->size); if (d->capacityReserved) { // cannot set unconditionally, since d could be shared_null or |