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.h | |
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.h')
-rw-r--r-- | qmake/library/proitems.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 6ce8c98789..5bfacf0b46 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -68,6 +68,7 @@ public: ProString(); ProString(const ProString &other); PROITEM_EXPLICIT ProString(const QString &str); + PROITEM_EXPLICIT ProString(const QStringRef &str); PROITEM_EXPLICIT ProString(const char *str); ProString(const QString &str, int offset, int length); void setValue(const QString &str); @@ -94,6 +95,7 @@ public: bool operator==(const ProString &other) const { return toQStringRef() == other.toQStringRef(); } bool operator==(const QString &other) const { return toQStringRef() == other; } + bool operator==(const QStringRef &other) const { return toQStringRef() == other; } bool operator==(QLatin1String other) const { return toQStringRef() == other; } bool operator==(const char *other) const { return toQStringRef() == QLatin1String(other); } bool operator!=(const ProString &other) const { return !(*this == other); } @@ -203,9 +205,9 @@ Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE); uint qHash(const ProString &str); QString operator+(const ProString &one, const ProString &two); inline QString operator+(const ProString &one, const QString &two) - { return one + ProString(two); } + { return one.toQStringRef() + two; } inline QString operator+(const QString &one, const ProString &two) - { return ProString(one) + two; } + { return one + two.toQStringRef(); } inline QString operator+(const ProString &one, const char *two) { QString ret = one.toQStringRef() + QLatin1String(two); ret.detach(); return ret; } |