diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-10 20:53:15 +0200 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2017-08-26 12:11:35 +0000 |
commit | eb0ba90b0af9fa7d5b70c74140f64295f2d05c18 (patch) | |
tree | 067e038cc04e971b989e33299d503cee0e864469 /qmake/library/proitems.cpp | |
parent | d293f071f5b5c4bdafa4bfcf55c778d09bf9661d (diff) |
qmake: make yet more use of ProString::toQStringRef()
in most cases, the main advantage is not using toQString(m_tmp), which
reduces the possibility of raw data leaks. in cases where we used
toQString() without temporary, this is a slight optimization.
Change-Id: Ib343acffd383aa2c4fefab75fb52762fb534dfc6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/library/proitems.cpp')
-rw-r--r-- | qmake/library/proitems.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp index 1744304c67..8bbde9f8c0 100644 --- a/qmake/library/proitems.cpp +++ b/qmake/library/proitems.cpp @@ -74,6 +74,11 @@ ProString::ProString(const QString &str) : { } +ProString::ProString(const QStringRef &str) : + m_string(*str.string()), m_offset(str.position()), m_length(str.size()), m_file(0), m_hash(0x80000000) +{ +} + ProString::ProString(const char *str, DoPreHashing) : m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0) { @@ -336,7 +341,7 @@ ProString ProString::trimmed() const QTextStream &operator<<(QTextStream &t, const ProString &str) { - t << str.toQString(); // XXX optimize ... somehow + t << str.toQStringRef(); return t; } |