Remove debugging code from QVector

It was depending on internals of Q_ASSERT

Change-Id: I3dfc0ae0438135a30961f36808dbfc3e663a5538
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jędrzej Nowacki 2012-05-31 09:49:26 +02:00 committed by Qt by Nokia
parent fbee9834dc
commit 7b737b172d

View File

@ -495,10 +495,7 @@ void QVector<T>::realloc(const int asize, const int aalloc, QArrayData::Allocati
Data *x = d; Data *x = d;
const bool isShared = d->ref.isShared(); const bool isShared = d->ref.isShared();
#ifndef QT_NO_DEBUG
bool moved = false;
int oldSize = d->size;
#endif
if (aalloc != 0) { if (aalloc != 0) {
if (aalloc != int(d->alloc) || isShared) { if (aalloc != int(d->alloc) || isShared) {
QT_TRY { QT_TRY {
@ -526,9 +523,6 @@ void QVector<T>::realloc(const int asize, const int aalloc, QArrayData::Allocati
// destruct unused / not moved data // destruct unused / not moved data
if (asize < d->size) if (asize < d->size)
destruct(d->begin() + asize, d->end()); destruct(d->begin() + asize, d->end());
#ifndef QT_NO_DEBUG
moved = true;
#endif
} }
if (asize > d->size) { if (asize > d->size) {
@ -563,11 +557,9 @@ void QVector<T>::realloc(const int asize, const int aalloc, QArrayData::Allocati
if (d != x) { if (d != x) {
if (!d->ref.deref()) { if (!d->ref.deref()) {
Q_ASSERT(!isShared); Q_ASSERT(!isShared);
Q_ASSERT(d->size == oldSize);
if (QTypeInfo<T>::isStatic || !aalloc) { if (QTypeInfo<T>::isStatic || !aalloc) {
// data was copy constructed, we need to call destructors // data was copy constructed, we need to call destructors
// or if !alloc we did nothing to the old 'd'. // or if !alloc we did nothing to the old 'd'.
Q_ASSERT(!moved);
free(d); free(d);
} else { } else {
Data::deallocate(d); Data::deallocate(d);