bearer plugins: fix uses of inefficient QLists

These types are larger than a void*, so holding them in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.

Fix by marking them movable, and holding in a QVector instead.

Change-Id: I78774fc78d787241aaadc4f819b6d229e6200f46
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
bb10
Marc Mutz 2015-07-05 22:43:08 +02:00
parent 24a96e2a3e
commit 47ca3f7813
2 changed files with 9 additions and 3 deletions

View File

@ -82,8 +82,9 @@ struct ConnmanMap {
QDBusObjectPath objectPath;
QVariantMap propertyMap;
};
typedef QList< ConnmanMap > ConnmanMapList;
Q_DECLARE_TYPEINFO(ConnmanMap, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, but cannot be
// marked as such until Qt 6
typedef QVector<ConnmanMap> ConnmanMapList;
QT_END_NAMESPACE

View File

@ -83,7 +83,12 @@ struct ObjectPathProperties
QDBusObjectPath path;
QVariantMap properties;
};
typedef QList<ObjectPathProperties> PathPropertiesList;
QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(ObjectPathProperties, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, but cannot be
// marked as such until Qt 6
QT_END_NAMESPACE
typedef QVector<ObjectPathProperties> PathPropertiesList;
Q_DECLARE_METATYPE(ObjectPathProperties)
Q_DECLARE_METATYPE (PathPropertiesList)