diff options
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/memory.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/core/os/memory.h b/core/os/memory.h index 9d09626b8c..f67384a17e 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -35,6 +35,7 @@ #include "core/templates/safe_refcount.h" #include <stddef.h> +#include <new> #ifndef PAD_ALIGN #define PAD_ALIGN 16 //must always be greater than this at much @@ -92,15 +93,8 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { #define memnew(m_class) _post_initialize(new ("") m_class) -_ALWAYS_INLINE_ void *operator new(size_t p_size, void *p_pointer, size_t check, const char *p_description) { - //void *failptr=0; - //ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ - - return p_pointer; -} - #define memnew_allocator(m_class, m_allocator) _post_initialize(new (m_allocator::alloc) m_class) -#define memnew_placement(m_placement, m_class) _post_initialize(new (m_placement, sizeof(m_class), "") m_class) +#define memnew_placement(m_placement, m_class) _post_initialize(new (m_placement) m_class) _ALWAYS_INLINE_ bool predelete_handler(void *) { return true; @@ -140,7 +134,7 @@ void memdelete_allocator(T *p_class) { #define memnew_arr(m_class, m_count) memnew_arr_template<m_class>(m_count) template <typename T> -T *memnew_arr_template(size_t p_elements, const char *p_descr = "") { +T *memnew_arr_template(size_t p_elements) { if (p_elements == 0) { return nullptr; } @@ -158,7 +152,7 @@ T *memnew_arr_template(size_t p_elements, const char *p_descr = "") { /* call operator new */ for (size_t i = 0; i < p_elements; i++) { - new (&elems[i], sizeof(T), p_descr) T; + new (&elems[i]) T; } } |