diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-04-26 12:06:17 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-30 17:07:27 +0200 |
commit | d17cf14185eb84863549e0119c8b7bd20db78580 (patch) | |
tree | 843efdf2b591293fabf8c5a7cf448d9514f35495 /src/corelib/tools/qvector.cpp | |
parent | 5131aefc1f0c04936e3ef19c9870d884775471e5 (diff) |
Implement QVector with QArrayData interface.
Change-Id: I109f46892aed2f6024459812d24922b12358814d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qvector.cpp')
-rw-r--r-- | src/corelib/tools/qvector.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 329727c8ea..a19599e861 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -47,40 +47,6 @@ QT_BEGIN_NAMESPACE -static inline int alignmentThreshold() -{ - // malloc on 32-bit platforms should return pointers that are 8-byte aligned or more - // while on 64-bit platforms they should be 16-byte aligned or more - return 2 * sizeof(void*); -} - -const QVectorData QVectorData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, false, 0 }; - -QVectorData *QVectorData::allocate(int size, int alignment) -{ - return static_cast<QVectorData *>(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : ::malloc(size)); -} - -QVectorData *QVectorData::reallocate(QVectorData *x, int newsize, int oldsize, int alignment) -{ - if (alignment > alignmentThreshold()) - return static_cast<QVectorData *>(qReallocAligned(x, newsize, oldsize, alignment)); - return static_cast<QVectorData *>(realloc(x, newsize)); -} - -void QVectorData::free(QVectorData *x, int alignment) -{ - if (alignment > alignmentThreshold()) - qFreeAligned(x); - else - ::free(x); -} - -int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT) -{ - return qAllocMore(size * sizeOfT, sizeOfHeader) / sizeOfT; -} - /*! \class QVector \brief The QVector class is a template class that provides a dynamic array. |