QDirIterator: move a guard condition from caller to callee
The private pushDirectory() method is only called from the QDirIterator ctor and from checkAndPushDirectory(). Moving the loop check from checkAndPushDirectory() to pushDirectory() therefore doesn't change anything, since, for the ctor case, it will always fail. This is preparation of using QDuplicateTracker for `visitedLinks`. Change-Id: I609934002dabebf0a3e7a516b8398eae7db770d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e62f6ffcb3
commit
1ba42c10bb
@ -210,6 +210,10 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo)
|
|||||||
path = fileInfo.canonicalFilePath();
|
path = fileInfo.canonicalFilePath();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Stop link loops
|
||||||
|
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
|
||||||
|
return;
|
||||||
|
|
||||||
if (iteratorFlags & QDirIterator::FollowSymlinks)
|
if (iteratorFlags & QDirIterator::FollowSymlinks)
|
||||||
visitedLinks << fileInfo.canonicalFilePath();
|
visitedLinks << fileInfo.canonicalFilePath();
|
||||||
|
|
||||||
@ -318,10 +322,6 @@ void QDirIteratorPrivate::checkAndPushDirectory(const QFileInfo &fileInfo)
|
|||||||
if (!(filters & QDir::AllDirs) && !(filters & QDir::Hidden) && fileInfo.isHidden())
|
if (!(filters & QDir::AllDirs) && !(filters & QDir::Hidden) && fileInfo.isHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop link loops
|
|
||||||
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pushDirectory(fileInfo);
|
pushDirectory(fileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user