Rename QVarLengthArray's private realloc() to reallocate()
This will enable run-time debugging on Windows, using _CRTDBG_MAP_MALLOC, which uses #define to override the standard library memory management functions, including realloc. Fixes: QTBUG-86395 Change-Id: I51975dd74cab0ae8309436c86d17a59074c561e1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
340b60ea2b
commit
43108bc6fa
|
|
@ -192,7 +192,7 @@ public:
|
|||
inline void append(const T &t) {
|
||||
if (s == a) { // i.e. s != 0
|
||||
T copy(t);
|
||||
realloc(s, s<<1);
|
||||
reallocate(s, s << 1);
|
||||
const qsizetype idx = s++;
|
||||
if (QTypeInfo<T>::isComplex) {
|
||||
new (ptr + idx) T(std::move(copy));
|
||||
|
|
@ -211,7 +211,7 @@ public:
|
|||
|
||||
void append(T &&t) {
|
||||
if (s == a)
|
||||
realloc(s, s << 1);
|
||||
reallocate(s, s << 1);
|
||||
const qsizetype idx = s++;
|
||||
if (QTypeInfo<T>::isComplex)
|
||||
new (ptr + idx) T(std::move(t));
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
void shrink_to_fit() { squeeze(); }
|
||||
|
||||
private:
|
||||
void realloc(qsizetype size, qsizetype alloc);
|
||||
void reallocate(qsizetype size, qsizetype alloc);
|
||||
|
||||
qsizetype a; // capacity
|
||||
qsizetype s; // size
|
||||
|
|
@ -331,11 +331,11 @@ Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(qsizetype asize)
|
|||
|
||||
template <class T, qsizetype Prealloc>
|
||||
Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::resize(qsizetype asize)
|
||||
{ realloc(asize, qMax(asize, a)); }
|
||||
{ reallocate(asize, qMax(asize, a)); }
|
||||
|
||||
template <class T, qsizetype Prealloc>
|
||||
Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::reserve(qsizetype asize)
|
||||
{ if (asize > a) realloc(s, asize); }
|
||||
{ if (asize > a) reallocate(s, asize); }
|
||||
|
||||
template <class T, qsizetype Prealloc>
|
||||
Q_INLINE_TEMPLATE qsizetype QVarLengthArray<T, Prealloc>::indexOf(const T &t, qsizetype from) const
|
||||
|
|
@ -392,7 +392,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, qs
|
|||
const qsizetype asize = s + increment;
|
||||
|
||||
if (asize >= a)
|
||||
realloc(s, qMax(s*2, asize));
|
||||
reallocate(s, qMax(s * 2, asize));
|
||||
|
||||
if (QTypeInfo<T>::isComplex) {
|
||||
// call constructor for new objects (which can throw)
|
||||
|
|
@ -406,10 +406,10 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, qs
|
|||
|
||||
template <class T, qsizetype Prealloc>
|
||||
Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::squeeze()
|
||||
{ realloc(s, s); }
|
||||
{ reallocate(s, s); }
|
||||
|
||||
template <class T, qsizetype Prealloc>
|
||||
Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(qsizetype asize, qsizetype aalloc)
|
||||
Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::reallocate(qsizetype asize, qsizetype aalloc)
|
||||
{
|
||||
Q_ASSERT(aalloc >= asize);
|
||||
T *oldPtr = ptr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue