diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-05-21 14:41:54 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-05 06:14:32 +0200 |
commit | 879539fb99f4cebd4ee53b8a42bb848a745ba36e (patch) | |
tree | 2fb1d77f3a6c28e2d9130c222c6b5363d2e9dedf /src/corelib | |
parent | 046c31988e5d166a12e77bb0d9dde074a97ec74a (diff) |
Rename QVector::realloc and QVector::free.
These names were confusing and conflicting with standard C memory
management functions.
Change-Id: I6efe20665d2ec7ad3e00f3a806cc1843a57374d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qvector.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 88a6744d11..e2cb7fbf23 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -73,7 +73,7 @@ public: explicit QVector(int size); QVector(int size, const T &t); inline QVector(const QVector<T> &v); - inline ~QVector() { if (!d->ref.deref()) free(d); } + inline ~QVector() { if (!d->ref.deref()) freeData(d); } QVector<T> &operator=(const QVector<T> &v); #ifdef Q_COMPILER_RVALUE_REFS inline QVector(QVector<T> &&other) : d(other.d) { other.d = Data::sharedNull(); } @@ -97,7 +97,7 @@ public: void reserve(int size); inline void squeeze() { - realloc(d->size, d->size); + reallocData(d->size, d->size); if (d->capacityReserved) { // capacity reserved in a read only memory would be useless // this checks avoid writing to such memory. @@ -220,8 +220,8 @@ public: private: friend class QRegion; // Optimization for QRegion::rects() - void realloc(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default); - void free(Data *d); + void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default); + void freeData(Data *d); void defaultConstruct(T *from, T *to); void copyConstruct(const T *srcFrom, const T *srcTo, T *dstFrom); void destruct(T *from, T *to); @@ -294,7 +294,7 @@ void QVector<T>::detach() { if (!isDetached()) { if (d->alloc) - realloc(d->size, int(d->alloc)); + reallocData(d->size, int(d->alloc)); else d = Data::unsharableEmpty(); } @@ -305,7 +305,7 @@ template <typename T> void QVector<T>::reserve(int asize) { if (asize > int(d->alloc)) - realloc(d->size, asize); + reallocData(d->size, asize); if (isDetached()) d->capacityReserved = 1; Q_ASSERT(capacity() >= asize); @@ -327,7 +327,7 @@ void QVector<T>::resize(int asize) } else { newAlloc = oldAlloc; } - realloc(asize, newAlloc, opt); + reallocData(asize, newAlloc, opt); } template <typename T> inline void QVector<T>::clear() @@ -421,14 +421,14 @@ QVector<T>::QVector(std::initializer_list<T> args) #endif template <typename T> -void QVector<T>::free(Data *x) +void QVector<T>::freeData(Data *x) { destruct(x->begin(), x->end()); Data::deallocate(x); } template <typename T> -void QVector<T>::realloc(const int asize, const int aalloc, QArrayData::AllocationOptions options) +void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::AllocationOptions options) { Q_ASSERT(asize >= 0 && asize <= aalloc); Data *x = d; @@ -499,7 +499,7 @@ void QVector<T>::realloc(const int asize, const int aalloc, QArrayData::Allocati if (QTypeInfo<T>::isStatic || !aalloc) { // data was copy constructed, we need to call destructors // or if !alloc we did nothing to the old 'd'. - free(d); + freeData(d); } else { Data::deallocate(d); } @@ -536,7 +536,7 @@ void QVector<T>::append(const T &t) const bool isTooSmall = uint(d->size + 1) > d->alloc; if (!isDetached() || isTooSmall) { QArrayData::AllocationOptions opt(isTooSmall ? QArrayData::Grow : QArrayData::Default); - realloc(d->size, isTooSmall ? d->size + 1 : d->alloc, opt); + reallocData(d->size, isTooSmall ? d->size + 1 : d->alloc, opt); } if (QTypeInfo<T>::isComplex) new (d->end()) T(copy); @@ -552,7 +552,7 @@ typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, c if (n != 0) { const T copy(t); if (!isDetached() || d->size + n > int(d->alloc)) - realloc(d->size, d->size + n, QArrayData::Grow); + reallocData(d->size, d->size + n, QArrayData::Grow); if (QTypeInfo<T>::isStatic) { T *b = d->end(); T *i = d->end() + n; @@ -650,7 +650,7 @@ template <typename T> QVector<T> &QVector<T>::operator+=(const QVector &l) { int newSize = d->size + l.d->size; - realloc(d->size, newSize); + reallocData(d->size, newSize); if (d->alloc) { T *w = d->begin() + newSize; |