summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstandardpaths_unix.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-05-19 10:42:04 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-05-21 08:57:49 +0200
commit94fbea2f302d240f7063fba5502634c0b3736430 (patch)
tree05108f50b99ca9c1cef215c93ae37ad215beb7bf /src/corelib/io/qstandardpaths_unix.cpp
parent1065777a2ac1e6a9a0c4fc64d6ee0de02124c682 (diff)
QFileSystemWatcher: fix quadratic loop by porting away from QMutableListIterator
QMutableListIterator::remove() is linear, so called in a loop, the loop potentially becomes quadratic. Fix by porting to std::remove_if. In this case, since the old code unconditionally detached, anyway, we use remove_copy_if to build a new list. That's still more efficient than the old code, even if nothing is removed. It also prepares the code for when Java-style iterators will be deprecated. Since the same code appears in two different functions, do an Extract Method into a file-static function. Lastly, restore NRVO for most compilers by returning the same object from all return statements of the function. Change-Id: I6909c6483d8f7acfd1bf381828f020038b04e431 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/io/qstandardpaths_unix.cpp')
0 files changed, 0 insertions, 0 deletions