diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp index 40c72f949c..4ed7f2be4d 100644 --- a/src/core/alloc_type.hpp +++ b/src/core/alloc_type.hpp @@ -10,8 +10,6 @@ #ifndef ALLOC_TYPE_HPP #define ALLOC_TYPE_HPP -#include "alloc_func.hpp" - /** * A reusable buffer that can be used for places that temporary allocate * a bit of memory and do that very often, or for places where static @@ -63,41 +61,4 @@ public: } }; -/** - * Base class that provides memory initialization on dynamically created objects. - * All allocated memory will be zeroed. - */ -class ZeroedMemoryAllocator -{ -public: - ZeroedMemoryAllocator() {} - virtual ~ZeroedMemoryAllocator() = default; - - /** - * Memory allocator for a single class instance. - * @param size the amount of bytes to allocate. - * @return the given amounts of bytes zeroed. - */ - inline void *operator new(size_t size) { return CallocT(size); } - - /** - * Memory allocator for an array of class instances. - * @param size the amount of bytes to allocate. - * @return the given amounts of bytes zeroed. - */ - inline void *operator new[](size_t size) { return CallocT(size); } - - /** - * Memory release for a single class instance. - * @param ptr the memory to free. - */ - inline void operator delete(void *ptr) { free(ptr); } - - /** - * Memory release for an array of class instances. - * @param ptr the memory to free. - */ - inline void operator delete[](void *ptr) { free(ptr); } -}; - #endif /* ALLOC_TYPE_HPP */ diff --git a/src/gfx.cpp b/src/gfx.cpp index 1f7d7c37a5..b9698b000f 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -8,6 +8,7 @@ /** @file gfx.cpp Handling of drawing text and other gfx related stuff. */ #include "stdafx.h" +#include "core/alloc_func.hpp" #include "gfx_layout.h" #include "progress.h" #include "zoom_func.h" diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 5a7da3d963..41dff33680 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -8,6 +8,7 @@ /** @file gfx_layout.cpp Handling of laying out text. */ #include "stdafx.h" +#include "core/alloc_func.hpp" #include "core/math_func.hpp" #include "gfx_layout.h" #include "string_func.h" diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 3e4abc5e79..739d57a13f 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -17,6 +17,7 @@ #include #include <../squirrel/sqpcheader.h> #include <../squirrel/sqvm.h> +#include "../core/alloc_func.hpp" /** * In the memory allocator for Squirrel we want to directly use malloc/realloc, so when the OS diff --git a/src/spritecache.cpp b/src/spritecache.cpp index a4eeb809ac..a81c5d4a32 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -8,6 +8,7 @@ /** @file spritecache.cpp Caching of sprites. */ #include "stdafx.h" +#include "core/alloc_func.hpp" #include "random_access_file_type.h" #include "spriteloader/grf.hpp" #include "spriteloader/makeindexed.h"