QVariant, QByteArrayMatcher, QListData and QString cleanup

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-05-23 00:04:11 +00:00
parent 32406e8e86
commit d6f5721d4c
5 changed files with 5 additions and 35 deletions

View file

@ -76,7 +76,6 @@ class QTextFormat;
class QTextLength;
class QUrl;
class QVariant;
class QVariantComparisonHelper;
class QDebug;
template <typename T>
@ -375,7 +374,6 @@ protected:
friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
friend int qRegisterGuiVariant();
friend int qUnregisterGuiVariant();
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
#endif
@ -452,30 +450,6 @@ Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant::Type& p);
Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
#endif
/* Helper class to add one more level of indirection to prevent
implicit casts.
*/
class QVariantComparisonHelper
{
public:
inline QVariantComparisonHelper(const QVariant &var)
: v(&var) {}
private:
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
const QVariant *v;
};
inline bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2)
{
return v1.cmp(*v2.v);
}
inline bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2)
{
return !operator==(v1, v2);
}
#ifndef QT_MOC
template<typename T> inline T qvariant_cast(const QVariant &v)
{

View file

@ -80,11 +80,8 @@ private:
const uchar *p;
int l;
};
union {
uint dummy[256];
Data p;
};
};
QT_END_NAMESPACE

View file

@ -68,7 +68,7 @@ struct Q_CORE_EXPORT QListData {
struct Data {
QAtomicInt ref;
int alloc, begin, end;
uint sharable : 1;
bool sharable;
void *array[1];
};
enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };

View file

@ -658,9 +658,9 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
*/
QString::Data QString::shared_null = { QAtomicInt(1),
0, 0, shared_null.array, 0, {0} };
0, 0, 0, shared_null.array, {0} };
QString::Data QString::shared_empty = { QAtomicInt(1),
0, 0, shared_empty.array, 0, {0} };
0, 0, 0, shared_empty.array, {0} };
int QString::grow(int size)
{

View file

@ -493,9 +493,8 @@ private:
struct Data {
QAtomicInt ref;
int alloc, size;
int alloc, size, capacity;
ushort *data;
ushort capacity : 1;
ushort array[1];
};
static Data shared_null;