QStorageInfo/Unix: check the mount point length before isParentOf()
Execute the cheaper test first, so we loop over the entries more quickly. Pick-to: 6.6 Change-Id: I9d43e5b91eb142d6945cfffd178749a12c966739 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
da95ad91b3
commit
94df3f8d6b
|
|
@ -143,7 +143,7 @@ void QStorageInfoPrivate::initRootPath()
|
|||
for (const MountInfo &info : infos) {
|
||||
// we try to find most suitable entry
|
||||
qsizetype mpSize = info.mountPoint.size();
|
||||
if (isParentOf(info.mountPoint, oldRootPath) && maxLength < mpSize) {
|
||||
if (maxLength < mpSize && isParentOf(info.mountPoint, oldRootPath)) {
|
||||
bestInfo = &info;
|
||||
maxLength = mpSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ void QStorageInfoPrivate::initRootPath()
|
|||
const QString mountDir = it.rootPath();
|
||||
const QByteArray fsName = it.fileSystemType();
|
||||
// we try to find most suitable entry
|
||||
if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.size()) {
|
||||
if (maxLength < mountDir.size() && isParentOf(mountDir, oldRootPath)) {
|
||||
maxLength = mountDir.size();
|
||||
rootPath = mountDir;
|
||||
device = it.device();
|
||||
|
|
|
|||
Loading…
Reference in New Issue