From 6d8ea540bd123270f0010eb5fa5e68a510ca89e7 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Fri, 29 Jan 2010 13:12:44 +0100 Subject: nano-optimizations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 445 Reviewed-by: João Abecasis --- src/corelib/io/qdir.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 0b6ad08..250e5e5 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1692,8 +1692,7 @@ bool QDir::remove(const QString &fileName) qWarning("QDir::remove: Empty or null file name"); return false; } - QString p = filePath(fileName); - return QFile::remove(p); + return QFile::remove(filePath(fileName)); } /*! @@ -1740,8 +1739,7 @@ bool QDir::exists(const QString &name) const qWarning("QDir::exists: Empty or null file name"); return false; } - QString tmp = filePath(name); - return QFile::exists(tmp); + return QFile::exists(filePath(name)); } /*! @@ -1984,7 +1982,7 @@ QString QDir::rootPath() */ bool QDir::match(const QStringList &filters, const QString &fileName) { - for (QStringList::ConstIterator sit = filters.begin(); sit != filters.end(); ++sit) { + for (QStringList::ConstIterator sit = filters.constBegin(); sit != filters.constEnd(); ++sit) { QRegExp rx(*sit, Qt::CaseInsensitive, QRegExp::Wildcard); if (rx.exactMatch(fileName)) return true; @@ -2126,12 +2124,8 @@ QString QDir::cleanPath(const QString &path) out[iwrite++] = p[i]; used++; } - QString ret; - if(used == len) - ret = name; - else - ret = QString(out, used); + QString ret = (used == len ? name : QString(out, used)); // Strip away last slash except for root directories if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { #ifdef Q_OS_WIN -- cgit v0.12