diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-10-03 21:54:18 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-07 08:53:23 +0200 |
commit | fb1306e33e448eb4437ea4ab311e3ba0b493206c (patch) | |
tree | 2544db9e36d5a4504b463d5858be4df759d68b55 /src/qml/qml | |
parent | d108aeacac4835758e3e5f605b4845958ac82825 (diff) |
QStringRef has toInt(), so no need to create a new QString
Saves up on memory allocations.
Change-Id: I0f7c82521b0b10085861fc62fed9b9d591169b5a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlscript.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp index 58aad8eb33..7996f9f48c 100644 --- a/src/qml/qml/qqmlscript.cpp +++ b/src/qml/qml/qqmlscript.cpp @@ -635,13 +635,11 @@ void ProcessAST::extractVersion(QStringRef string, int *maj, int *min) int dot = string.indexOf(QLatin1Char('.')); if (dot < 0) { - *maj = string.toString().toInt(); + *maj = string.toInt(); *min = 0; } else { - const QString *s = string.string(); - int p = string.position(); - *maj = QStringRef(s, p, dot).toString().toInt(); - *min = QStringRef(s, p + dot + 1, string.size() - dot - 1).toString().toInt(); + *maj = string.left(dot).toInt(); + *min = string.mid(dot + 1).toInt(); } } } |