From fb1306e33e448eb4437ea4ab311e3ba0b493206c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 Oct 2013 21:54:18 -0700 Subject: QStringRef has toInt(), so no need to create a new QString Saves up on memory allocations. Change-Id: I0f7c82521b0b10085861fc62fed9b9d591169b5a Reviewed-by: Simon Hausmann Reviewed-by: Lars Knoll --- src/qml/compiler/qqmlcodegenerator.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/qml/compiler/qqmlcodegenerator.cpp') diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index 2394b07cdf..fb2ca7c14e 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -742,13 +742,11 @@ void QQmlCodeGenerator::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(); } } } -- cgit v1.2.3