Micro-optimize QDir::relativeFilePath
Use QString::splitRef on platforms with case sensitive paths, to avoid unnecessary allocations. Change-Id: Iff331a5eb67c4cbaf1333e663e77290261c5b013 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
b1202e0234
commit
4413254ff6
@ -760,9 +760,13 @@ QString QDir::relativeFilePath(const QString &fileName) const
|
||||
#endif
|
||||
|
||||
QString result;
|
||||
#if defined(Q_OS_WIN)
|
||||
QStringList dirElts = dir.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
QStringList fileElts = file.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
|
||||
#else
|
||||
QVector<QStringRef> dirElts = dir.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
#endif
|
||||
int i = 0;
|
||||
while (i < dirElts.size() && i < fileElts.size() &&
|
||||
#if defined(Q_OS_WIN)
|
||||
|
Loading…
Reference in New Issue
Block a user