diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qglobal.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qbytedata_p.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 11 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 11 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream.g | 4 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream_p.h | 4 |
8 files changed, 30 insertions, 27 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 24e05fc72c..22f65a6aba 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1193,13 +1193,11 @@ inline void qSwap(T &value1, T &value2) #endif } -/* - These functions make it possible to use standard C++ functions with - a similar name from Qt header files (especially template classes). -*/ -Q_CORE_EXPORT void *qMalloc(size_t size) Q_ALLOC_SIZE(1); -Q_CORE_EXPORT void qFree(void *ptr); -Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2); +#if QT_DEPRECATED_SINCE(5, 0) +Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); +Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); +Q_CORE_EXPORT QT_DEPRECATED void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2); +#endif Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1); Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2); Q_CORE_EXPORT void qFreeAligned(void *ptr); diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 1e70e26be3..31fa462ca4 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -45,6 +45,7 @@ #include <QtCore/qrefcount.h> #include <QtCore/qnamespace.h> +#include <stdlib.h> #include <string.h> #include <stdarg.h> @@ -402,7 +403,7 @@ public: }; inline QByteArray::QByteArray(): d(const_cast<Data *>(&shared_null.ba)) { } -inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); } +inline QByteArray::~QByteArray() { if (!d->ref.deref()) free(d); } inline int QByteArray::size() const { return d->size; } diff --git a/src/corelib/tools/qbytedata_p.h b/src/corelib/tools/qbytedata_p.h index 763b71c8f3..2deff997d2 100644 --- a/src/corelib/tools/qbytedata_p.h +++ b/src/corelib/tools/qbytedata_p.h @@ -102,7 +102,7 @@ public: bufferCompleteSize += bd.size(); } - // return the first QByteData. User of this function has to qFree() its .data! + // return the first QByteData. User of this function has to free() its .data! // preferably use this function to read data. inline QByteArray read() { @@ -110,14 +110,14 @@ public: return buffers.takeFirst(); } - // return everything. User of this function has to qFree() its .data! + // return everything. User of this function has to free() its .data! // avoid to use this, it might malloc and memcpy. inline QByteArray readAll() { return read(byteAmount()); } - // return amount. User of this function has to qFree() its .data! + // return amount. User of this function has to free() its .data! // avoid to use this, it might malloc and memcpy. inline QByteArray read(qint64 amount) { @@ -128,7 +128,7 @@ public: return byteData; } - // return amount bytes. User of this function has to qFree() its .data! + // return amount bytes. User of this function has to free() its .data! // avoid to use this, it will memcpy. qint64 read(char* dst, qint64 amount) { diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index a15b0c9124..9d70e55b1e 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -55,6 +55,7 @@ #include <initializer_list> #endif +#include <stdlib.h> #include <new> #include <limits.h> #include <string.h> @@ -667,7 +668,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.begin() + i), n); } QT_CATCH(...) { - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -677,7 +678,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i } QT_CATCH(...) { node_destruct(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.begin() + i)); - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -696,7 +697,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc) QT_TRY { node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n); } QT_CATCH(...) { - qFree(d); + free(d); d = x; QT_RETHROW; } @@ -721,7 +722,7 @@ Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l) struct Cleanup { Cleanup(QListData::Data *d) : d_(d) {} - ~Cleanup() { if (d_) qFree(d_); } + ~Cleanup() { if (d_) free(d_); } QListData::Data *d_; } tryCatch(d); @@ -763,7 +764,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data) { node_destruct(reinterpret_cast<Node *>(data->array + data->begin), reinterpret_cast<Node *>(data->array + data->end)); - qFree(data); + free(data); } diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 4e1027e86a..c01a623414 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -44,6 +44,8 @@ #include <QtCore/qglobal.h> +#include <stdlib.h> + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -79,7 +81,7 @@ struct QScopedPointerArrayDeleter struct QScopedPointerPodDeleter { - static inline void cleanup(void *pointer) { if (pointer) qFree(pointer); } + static inline void cleanup(void *pointer) { if (pointer) free(pointer); } }; template <typename T, typename Cleanup = QScopedPointerDeleter<T> > diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 4e042f765e..6ce6573843 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -48,6 +48,7 @@ #include <new> #include <string.h> +#include <stdlib.h> QT_BEGIN_HEADER @@ -77,7 +78,7 @@ public: i->~T(); } if (ptr != reinterpret_cast<T *>(array)) - qFree(ptr); + free(ptr); } inline QVarLengthArray<T, Prealloc> &operator=(const QVarLengthArray<T, Prealloc> &other) { @@ -190,7 +191,7 @@ template <class T, int Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) : s(asize) { if (s > Prealloc) { - ptr = reinterpret_cast<T *>(qMalloc(s * sizeof(T))); + ptr = reinterpret_cast<T *>(malloc(s * sizeof(T))); Q_CHECK_PTR(ptr); a = s; } else { @@ -243,7 +244,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a const int copySize = qMin(asize, osize); if (aalloc != a) { - ptr = reinterpret_cast<T *>(qMalloc(aalloc * sizeof(T))); + ptr = reinterpret_cast<T *>(malloc(aalloc * sizeof(T))); Q_CHECK_PTR(ptr); if (ptr) { s = 0; @@ -263,7 +264,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a while (sClean < osize) (oldPtr+(sClean++))->~T(); if (oldPtr != reinterpret_cast<T *>(array) && oldPtr != ptr) - qFree(oldPtr); + free(oldPtr); QT_RETHROW; } } else { @@ -283,7 +284,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a } if (oldPtr != reinterpret_cast<T *>(array) && oldPtr != ptr) - qFree(oldPtr); + free(oldPtr); if (QTypeInfo<T>::isComplex) { // call default constructor for new objects (which can throw) diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index 87a10003d3..a1d1e84b51 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -152,12 +152,12 @@ template <typename T> class QXmlStreamSimpleStack { int tos, cap; public: inline QXmlStreamSimpleStack():data(0), tos(-1), cap(0){} - inline ~QXmlStreamSimpleStack(){ if (data) qFree(data); } + inline ~QXmlStreamSimpleStack(){ if (data) free(data); } inline void reserve(int extraCapacity) { if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); - data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T))); + data = reinterpret_cast<T *>(realloc(data, cap * sizeof(T))); Q_CHECK_PTR(data); } } diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 067216d3a1..b8a87fbc3f 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -646,12 +646,12 @@ template <typename T> class QXmlStreamSimpleStack { int tos, cap; public: inline QXmlStreamSimpleStack():data(0), tos(-1), cap(0){} - inline ~QXmlStreamSimpleStack(){ if (data) qFree(data); } + inline ~QXmlStreamSimpleStack(){ if (data) free(data); } inline void reserve(int extraCapacity) { if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); - data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T))); + data = reinterpret_cast<T *>(realloc(data, cap * sizeof(T))); Q_CHECK_PTR(data); } } |