diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-04-14 16:28:08 +0200 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-04-15 22:52:50 +0100 |
commit | 4e85ccf3c049cb508873bb8320f770c328e76513 (patch) | |
tree | 9e1e144e2f77f5c31a3bd32f19158e8db4e0b2b2 /src/core | |
parent | 79343762a4ec02cc78efcec4b38b8ffda4910772 (diff) | |
download | openttd-4e85ccf3c049cb508873bb8320f770c328e76513.tar.xz |
Codechange: Replace SmallStackSafeStackAlloc with std::array.
The only port that ever used it to make heap allocations instead of stack ones was the NDS port, which got thrown out some time ago.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/alloc_type.hpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp index 685ff9890..1da080d98 100644 --- a/src/core/alloc_type.hpp +++ b/src/core/alloc_type.hpp @@ -15,49 +15,6 @@ #include "alloc_func.hpp" /** - * A small 'wrapper' for allocations that can be done on most OSes on the - * stack, but are just too large to fit in the stack on devices with a small - * stack such as the NDS. - * So when it is possible a stack allocation is made, otherwise a heap - * allocation is made and this is freed once the struct goes out of scope. - * @param T the type to make the allocation for - * @param length the amount of items to allocate - */ -template <typename T, size_t length> -struct SmallStackSafeStackAlloc { - /** Storing the data on the stack */ - T data[length]; - - /** - * Gets a pointer to the data stored in this wrapper. - * @return the pointer. - */ - inline operator T *() - { - return data; - } - - /** - * Gets a pointer to the data stored in this wrapper. - * @return the pointer. - */ - inline T *operator -> () - { - return data; - } - - /** - * Gets a pointer to the last data element stored in this wrapper. - * @note needed because endof does not work properly for pointers. - * @return the 'endof' pointer. - */ - inline T *EndOf() - { - return endof(data); - } -}; - -/** * 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 * memory is allocated that might need to be reallocated sometimes. |