summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-04-13 14:45:53 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-19 12:31:40 +0000
commite9fd074cecfa5bb79bbaa5522a31aa28e3db43a8 (patch)
treeb3028878cf06ccf79370132d73d43f7b432749e0
parentba5db13c8d197706ac3dec5d351b6684f809f2e4 (diff)
Use qToStringViewIgnoringNull() where applicable
Saves just over ¬ľKiB in QtCore text size on optimized GCC 6.1 Linux AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use. Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/tools/qregularexpression.cpp10
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/gui/painting/qcolor.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index b1f9d460b3..8ad907f72b 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -2108,7 +2108,7 @@ QStringView QRegularExpressionMatch::capturedView(int nth) const
*/
QString QRegularExpressionMatch::captured(const QString &name) const
{
- return captured(QStringView(name));
+ return captured(qToStringViewIgnoringNull(name));
}
/*!
@@ -2123,7 +2123,7 @@ QString QRegularExpressionMatch::captured(const QString &name) const
*/
QStringRef QRegularExpressionMatch::capturedRef(const QString &name) const
{
- return capturedRef(QStringView(name));
+ return capturedRef(qToStringViewIgnoringNull(name));
}
#endif // QT_STRINGVIEW_LEVEL < 2
@@ -2267,7 +2267,7 @@ int QRegularExpressionMatch::capturedEnd(int nth) const
*/
int QRegularExpressionMatch::capturedStart(const QString &name) const
{
- return capturedStart(QStringView(name));
+ return capturedStart(qToStringViewIgnoringNull(name));
}
/*!
@@ -2281,7 +2281,7 @@ int QRegularExpressionMatch::capturedStart(const QString &name) const
*/
int QRegularExpressionMatch::capturedLength(const QString &name) const
{
- return capturedLength(QStringView(name));
+ return capturedLength(qToStringViewIgnoringNull(name));
}
/*!
@@ -2294,7 +2294,7 @@ int QRegularExpressionMatch::capturedLength(const QString &name) const
*/
int QRegularExpressionMatch::capturedEnd(const QString &name) const
{
- return capturedEnd(QStringView(name));
+ return capturedEnd(qToStringViewIgnoringNull(name));
}
#endif // QT_STRINGVIEW_LEVEL < 2
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 4fd10f3ce8..6bd2db0de3 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -7723,7 +7723,7 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, int fiel
*/
QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const
{
- return arg(QStringView(a), fieldWidth, fillChar);
+ return arg(qToStringViewIgnoringNull(a), fieldWidth, fillChar);
}
#endif // QT_STRINGVIEW_LEVEL < 2
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 3cb81a657f..855f245396 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -884,7 +884,7 @@ QString QColor::name(NameFormat format) const
void QColor::setNamedColor(const QString &name)
{
- setColorFromString(QStringView(name));
+ setColorFromString(qToStringViewIgnoringNull(name));
}
#endif
@@ -922,7 +922,7 @@ void QColor::setNamedColor(QLatin1String name)
*/
bool QColor::isValidColor(const QString &name)
{
- return isValidColor(QStringView(name));
+ return isValidColor(qToStringViewIgnoringNull(name));
}
#endif