Optimise the code in checkPreviewInternal(): use const where possible,
and use range-for instead of iterator-based loops.
Details
Details
- Reviewers
dfaure apol - Maniphest Tasks
- T12279: Port frameworks away from QRegExp
- Commits
- R241:c930030308cc: [KFileWidgets] Port QRegExp to QRegularExpression
make && ctest
Diff Detail
Diff Detail
- Repository
- R241 KIO
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
src/filewidgets/kdiroperator.cpp | ||
---|---|---|
1481 | const QStringList result = rather than declaring result before the loop. But while we're here, shouldn't we use indexOf() instead of filter()? All we care for is "there is at least one match". | |
1489 | declare where used | |
1490 | declare where used (this also makes refactoring easier btw) | |
1504 | You could combine this with the next line and kill the "match" variable. More compact and more readable IMHO. | |
src/filewidgets/kfilewidget.cpp | ||
2458 | declare where used | |
2462 | (same) |
src/filewidgets/kfilewidget.cpp | ||
---|---|---|
2458 | Declaring rx before the for-loop isn't more efficient? then inside the for-loop it's the same QRegularExpression object and setPattern() is called. |
src/filewidgets/kfilewidget.cpp | ||
---|---|---|
2458 | Hmm OK this isn't like QString, reusing rx saves allocating/deallocating its d pointer indeed. |