Extract header qmalloc.h from qglobal.h

Definitions of qMallocAligned()/qReallocAligned()/qFreeAligned() were
already in qmalloc.cpp, so add qmalloc.h for declarations.

Task-number: QTBUG-99313
Change-Id: I8028402a2c48dede855ad7de35d7b77e9911c761
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sona Kurazyan 2022-08-22 16:44:55 +02:00
parent d9544394b0
commit 48aa320569
4 changed files with 25 additions and 5 deletions

View File

@ -64,7 +64,7 @@ qt_internal_add_module(Core
global/qhooks.cpp global/qhooks_p.h
global/qlibraryinfo.cpp global/qlibraryinfo.h global/qlibraryinfo_p.h
global/qlogging.cpp global/qlogging.h global/qlogging_p.h
global/qmalloc.cpp
global/qmalloc.cpp global/qmalloc.h
global/qminmax.h
global/qnamespace.h # this header is specified on purpose so AUTOMOC processes it
global/qnativeinterface.h global/qnativeinterface_p.h

View File

@ -136,10 +136,6 @@ typedef void (*QFunctionPointer)();
# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
#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);
// this adds const to non-const objects (like std::as_const)
template <typename T>
@ -174,6 +170,7 @@ QT_END_NAMESPACE
#include <QtCore/qexceptionhandling.h>
#include <QtCore/qforeach.h>
#include <QtCore/qglobalstatic.h>
#include <QtCore/qmalloc.h>
#include <QtCore/qminmax.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qoverload.h>

View File

@ -1,6 +1,7 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qmalloc.h"
#include "qplatformdefs.h"
#include <stdlib.h>

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMALLOC_H
#define QMALLOC_H
#include <QtCore/qglobal.h>
#if 0
#pragma qt_class(QtMalloc)
#pragma qt_sync_stop_processing
#endif
QT_BEGIN_NAMESPACE
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);
QT_END_NAMESPACE
#endif // QMALLOC_H