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>bb10
parent
e62f6ffcb3
commit
1ba42c10bb
|
|
@ -210,6 +210,10 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo)
|
|||
path = fileInfo.canonicalFilePath();
|
||||
#endif
|
||||
|
||||
// Stop link loops
|
||||
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
|
||||
return;
|
||||
|
||||
if (iteratorFlags & QDirIterator::FollowSymlinks)
|
||||
visitedLinks << fileInfo.canonicalFilePath();
|
||||
|
||||
|
|
@ -318,10 +322,6 @@ void QDirIteratorPrivate::checkAndPushDirectory(const QFileInfo &fileInfo)
|
|||
if (!(filters & QDir::AllDirs) && !(filters & QDir::Hidden) && fileInfo.isHidden())
|
||||
return;
|
||||
|
||||
// Stop link loops
|
||||
if (visitedLinks.contains(fileInfo.canonicalFilePath()))
|
||||
return;
|
||||
|
||||
pushDirectory(fileInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue