/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, Daniel Bertalan * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #if defined(KERNEL) # include #else # include # include # define kcalloc calloc # define kmalloc malloc # define kmalloc_good_size malloc_good_size # define kfree free inline void kfree_sized(void* ptr, size_t) { kfree(ptr); } #endif #ifndef __serenity__ # include # ifndef AK_OS_MACOS extern "C" { inline size_t malloc_good_size(size_t size) { return size; } } # else # include # endif #endif #ifdef KERNEL # define AK_MAKE_ETERNAL \ public: \ void* operator new(size_t size) { return kmalloc_eternal(size); } \ \ private: #else # define AK_MAKE_ETERNAL #endif using std::nothrow;