QStorageInfo/Linux: don't copy the mount info's contents until the end
All these where somewhat cheap to copy (QStrings and QByteArrays), but why copy multiple times at all? Just copy at the end. Pick-to: 6.6 Change-Id: I9d43e5b91eb142d6945cfffd1787497434632dd4 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
c8d31833f0
commit
914b3bc985
|
|
@ -139,17 +139,21 @@ void QStorageInfoPrivate::initRootPath()
|
|||
const QString oldRootPath = rootPath;
|
||||
rootPath.clear();
|
||||
|
||||
for (auto &info : infos) {
|
||||
const MountInfo *bestInfo = nullptr;
|
||||
for (const MountInfo &info : infos) {
|
||||
// we try to find most suitable entry
|
||||
qsizetype mpSize = info.mountPoint.size();
|
||||
if (isParentOf(info.mountPoint, oldRootPath) && maxLength < mpSize) {
|
||||
bestInfo = &info;
|
||||
maxLength = mpSize;
|
||||
rootPath = info.mountPoint;
|
||||
device = info.device;
|
||||
fileSystemType = info.fsType;
|
||||
subvolume = info.fsRoot;
|
||||
}
|
||||
}
|
||||
if (bestInfo) {
|
||||
rootPath = bestInfo->mountPoint;
|
||||
device = bestInfo->device;
|
||||
fileSystemType = bestInfo->fsType;
|
||||
subvolume = bestInfo->fsRoot;
|
||||
}
|
||||
}
|
||||
|
||||
QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
|
||||
|
|
|
|||
Loading…
Reference in New Issue