aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4numberobject.cpp
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2015-08-12 13:17:58 +0100
committerSérgio Martins <sergio.martins@kdab.com>2015-08-13 16:11:48 +0000
commitb5572010798198de7b58ca3b905cb2691a316d1a (patch)
treeb15505115ab0f68fcb6defd338c28a673af8ad65 /src/qml/jsruntime/qv4numberobject.cpp
parentfbdc01f141a4ec4e6fc78ea69d86ff7aa128bf72 (diff)
qml: Avoid heap allocations due to QString::fromLatin1()
By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4numberobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 36b83090e1..096fe9fb4c 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -124,7 +124,7 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
if (ctx->argc() && !ctx->args()[0].isUndefined()) {
int radix = ctx->args()[0].toInt32();
if (radix < 2 || radix > 36)
- return ctx->engine()->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
+ return ctx->engine()->throwError(QStringLiteral("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
if (std::isnan(num)) {
@@ -202,7 +202,7 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
QString str;
if (std::isnan(v))
- str = QString::fromLatin1("NaN");
+ str = QStringLiteral("NaN");
else if (qIsInf(v))
str = QString::fromLatin1(v < 0 ? "-Infinity" : "Infinity");
else if (v < 1.e21) {