summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringalgorithms.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-07 18:54:33 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-07-29 21:07:08 +0300
commit4628351c3f53e3239e304b906a0f6f9a6daab985 (patch)
treec49ba6363a8ff67d3e6b63ecec278a28a19b18fb /src/corelib/text/qstringalgorithms.h
parent1fcd8345ac5fcc47883c082fa1d39110e4b2cb55 (diff)
QStandardPaths: don't build a QHash just to look up one key
The code parses a file, looking for XDG_*_DIR entries and stores each one's key and raw value in a QHash. After parsing, it, however, looked up exactly once, by a key it could have known all along. So, move the key computation before the opening of the file, and look for the correct key directly, consciously striving to continue to find, as the old code implicitly did, the last entry, since man 5 user-dirs.dirs explains: > The format of user-dirs.dirs is designed to allow direct sourcing of > this file in shell scripts. Which means last one wins. Port to QStringView API of QRegularExpression, too. Change-Id: Ie92b689b5b9221df918c67b96f2f6a09827e7b1e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/text/qstringalgorithms.h')
0 files changed, 0 insertions, 0 deletions