From ea7d85457d30e915ad470919d2e74867cba9cad8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 2 May 2020 23:03:39 +0200 Subject: QFileSystemEngine: port a local QSet to QDuplicateTracker Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: Ife8e09b4a54060ef52c9aac43e400736ea398c29 Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/io/qfilesystemengine.cpp') diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index 21847c2a7c..bfecc4fe83 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -45,6 +45,7 @@ #ifdef QT_BUILD_CORE_LIB #include #endif +#include QT_BEGIN_NAMESPACE @@ -64,9 +65,9 @@ QString QFileSystemEngine::slowCanonicalized(const QString &path) QString tmpPath = path; int separatorPos = 0; QSet nonSymlinks; - QSet known; + QDuplicateTracker known; - known.insert(path); + (void)known.hasSeen(path); do { #ifdef Q_OS_WIN if (separatorPos == 0) { @@ -94,9 +95,8 @@ QString QFileSystemEngine::slowCanonicalized(const QString &path) tmpPath = QDir::cleanPath(target); separatorPos = 0; - if (known.contains(tmpPath)) + if (known.hasSeen(tmpPath)) return QString(); - known.insert(tmpPath); } else { nonSymlinks.insert(prefix); } -- cgit v1.2.3