OSDN Git Service

remove redundant QProcEnvKey
authorIvailo Monev <xakepa10@laimg.moc>
Wed, 25 Dec 2019 04:17:48 +0000 (04:17 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Wed, 25 Dec 2019 04:17:48 +0000 (04:17 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/io/qprocess_p.h
src/core/io/qprocess_unix.cpp

index 4c2b7fd..67000d5 100644 (file)
@@ -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;
     }
index a83d66c..75cb3be 100644 (file)
@@ -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('=');