summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h12
-rw-r--r--src/corelib/tools/qbytearray.h3
-rw-r--r--src/corelib/tools/qbytedata_p.h8
-rw-r--r--src/corelib/tools/qlist.h11
-rw-r--r--src/corelib/tools/qscopedpointer.h4
-rw-r--r--src/corelib/tools/qvarlengtharray.h11
-rw-r--r--src/corelib/xml/qxmlstream.g4
-rw-r--r--src/corelib/xml/qxmlstream_p.h4
-rw-r--r--src/gui/painting/qdatabuffer_p.h12
-rw-r--r--src/testlib/qabstracttestlogger_p.h7
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h9
11 files changed, 46 insertions, 39 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);
}
}
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index e2855c80d0..0eea4c641f 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -55,6 +55,8 @@
#include "QtCore/qbytearray.h"
+#include <stdlib.h>
+
QT_BEGIN_NAMESPACE
template <typename Type> class QDataBuffer
@@ -64,7 +66,7 @@ public:
{
capacity = res;
if (res)
- buffer = (Type*) qMalloc(capacity * sizeof(Type));
+ buffer = (Type*) malloc(capacity * sizeof(Type));
else
buffer = 0;
siz = 0;
@@ -73,7 +75,7 @@ public:
~QDataBuffer()
{
if (buffer)
- qFree(buffer);
+ free(buffer);
}
inline void reset() { siz = 0; }
@@ -112,16 +114,16 @@ public:
capacity = 1;
while (capacity < size)
capacity *= 2;
- buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
}
}
inline void shrink(int size) {
capacity = size;
if (size)
- buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
else {
- qFree(buffer);
+ free(buffer);
buffer = 0;
}
}
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h
index fcd2feeeb4..585ef0bc7f 100644
--- a/src/testlib/qabstracttestlogger_p.h
+++ b/src/testlib/qabstracttestlogger_p.h
@@ -55,6 +55,7 @@
#include <qglobal.h>
#include <stdio.h>
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -116,7 +117,7 @@ struct QTestCharBuffer
inline ~QTestCharBuffer()
{
if (buf != staticBuf)
- qFree(buf);
+ free(buf);
}
inline char *data()
@@ -144,10 +145,10 @@ struct QTestCharBuffer
char *newBuf = 0;
if (buf == staticBuf) {
// if we point to our internal buffer, we need to malloc first
- newBuf = reinterpret_cast<char *>(qMalloc(newSize));
+ newBuf = reinterpret_cast<char *>(malloc(newSize));
} else {
// if we already malloc'ed, just realloc
- newBuf = reinterpret_cast<char *>(qRealloc(buf, newSize));
+ newBuf = reinterpret_cast<char *>(realloc(buf, newSize));
}
// if the allocation went wrong (newBuf == 0), we leave the object as is
diff --git a/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h b/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h
index fd52fd25e4..113166644a 100644
--- a/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h
@@ -60,6 +60,7 @@
#include <QtCore/qdebug.h>
#include <cstring>
+#include <stdlib.h>
QT_QML_BEGIN_NAMESPACE
@@ -84,10 +85,10 @@ public:
if (_blocks) {
for (int i = 0; i < _allocatedBlocks; ++i) {
if (char *b = _blocks[i])
- qFree(b);
+ free(b);
}
- qFree(_blocks);
+ free(_blocks);
}
}
@@ -119,7 +120,7 @@ private:
else
_allocatedBlocks *= 2;
- _blocks = (char **) qRealloc(_blocks, sizeof(char *) * _allocatedBlocks);
+ _blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
_blocks[index] = 0;
@@ -128,7 +129,7 @@ private:
char *&block = _blocks[_blockCount];
if (! block)
- block = (char *) qMalloc(BLOCK_SIZE);
+ block = (char *) malloc(BLOCK_SIZE);
_ptr = block;
_end = _ptr + BLOCK_SIZE;