2018-10-24 00:20:51 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2019-11-14 07:23:33 +08:00
|
|
|
#include <stdlib.h>
|
2018-10-24 00:20:51 +08:00
|
|
|
|
2019-12-13 18:27:44 +08:00
|
|
|
#if __cplusplus < 201103L
|
|
|
|
#define NOEXCEPT
|
|
|
|
#else /* >= C++11 */
|
|
|
|
#define NOEXCEPT noexcept
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2018-10-24 00:20:51 +08:00
|
|
|
void* operator new(size_t size)
|
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
return malloc(size);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void* operator new[](size_t size)
|
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
return malloc(size);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 18:27:44 +08:00
|
|
|
void operator delete(void* ptr) NOEXCEPT
|
2018-10-24 00:20:51 +08:00
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
free(ptr);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 18:27:44 +08:00
|
|
|
void operator delete[](void* ptr) NOEXCEPT
|
2018-10-24 00:20:51 +08:00
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
free(ptr);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#if (__cplusplus > 201103L)
|
2019-12-13 18:27:44 +08:00
|
|
|
void operator delete(void* ptr, size_t) NOEXCEPT
|
2018-10-24 00:20:51 +08:00
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
free(ptr);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 18:27:44 +08:00
|
|
|
void operator delete[](void* ptr, size_t) NOEXCEPT
|
2018-10-24 00:20:51 +08:00
|
|
|
{
|
2019-11-14 07:23:33 +08:00
|
|
|
free(ptr);
|
2018-10-24 00:20:51 +08:00
|
|
|
}
|
|
|
|
#endif // __cplusplus > 201103L
|