From 898418ff3c5d8e3bcde8d86763c239427401e246 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 25 Dec 2019 04:17:48 +0000 Subject: [PATCH] remove redundant QProcEnvKey Signed-off-by: Ivailo Monev --- src/core/io/qprocess_p.h | 22 ++++------------------ src/core/io/qprocess_unix.cpp | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/core/io/qprocess_p.h b/src/core/io/qprocess_p.h index 4c2b7fdb3..67000d53a 100644 --- a/src/core/io/qprocess_p.h +++ b/src/core/io/qprocess_p.h @@ -60,19 +60,6 @@ QT_BEGIN_NAMESPACE class QSocketNotifier; class QTimer; -class QProcEnvKey -{ -public: - QProcEnvKey() : hash(0) {} - explicit QProcEnvKey(const QByteArray &other) : key(other), hash(qHash(key)) {} - QProcEnvKey(const QProcEnvKey &other) { *this = other; } - bool operator==(const QProcEnvKey &other) const { return key == other.key; } - - QByteArray key; - uint hash; -}; -inline uint qHash(const QProcEnvKey &key) { return key.hash; } - class QProcEnvValue { public: @@ -103,23 +90,22 @@ public: mutable QString stringValue; }; Q_DECLARE_TYPEINFO(QProcEnvValue, Q_MOVABLE_TYPE); -Q_DECLARE_TYPEINFO(QProcEnvKey, Q_MOVABLE_TYPE); class QProcessEnvironmentPrivate: public QSharedData { public: - typedef QProcEnvKey Key; + typedef QByteArray Key; typedef QProcEnvValue Value; inline Key prepareName(const QString &name) const { Key &ent = nameMap[name]; - if (ent.key.isEmpty()) - ent = Key(name.toLocal8Bit()); + if (ent.isEmpty()) + ent = name.toLocal8Bit(); return ent; } inline QString nameToString(const Key &name) const { - const QString sname = QString::fromLocal8Bit(name.key.constData()); + const QString sname = QString::fromLocal8Bit(name.constData()); nameMap[sname] = name; return sname; } diff --git a/src/core/io/qprocess_unix.cpp b/src/core/io/qprocess_unix.cpp index a83d66ced..75cb3be0c 100644 --- a/src/core/io/qprocess_unix.cpp +++ b/src/core/io/qprocess_unix.cpp @@ -493,7 +493,7 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm QProcessEnvironmentPrivate::Hash::ConstIterator it = environment.constBegin(); const QProcessEnvironmentPrivate::Hash::ConstIterator end = environment.constEnd(); for ( ; it != end; ++it) { - QByteArray key = it.key().key; + QByteArray key = it.key(); QByteArray value = it.value().bytes(); key.reserve(key.length() + 1 + value.length()); key.append('='); -- 2.11.0