Go to the source code of this file.
Data Structures | |
struct | SmallStackSafeStackAlloc< T, length > |
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. More... | |
Functions | |
void | MallocError (size_t size) |
Functions to exit badly with an error message. | |
void | ReallocError (size_t size) |
Function to exit with an error message after realloc() have failed. | |
template<typename T> | |
FORCEINLINE T * | MallocT (size_t num_elements) |
Simplified allocation function that allocates the specified number of elements of the given type. | |
template<typename T> | |
FORCEINLINE T * | CallocT (size_t num_elements) |
Simplified allocation function that allocates the specified number of elements of the given type. | |
template<typename T> | |
FORCEINLINE T * | ReallocT (T *t_ptr, size_t num_elements) |
Simplified reallocation function that allocates the specified number of elements of the given type. |
Definition in file alloc_func.hpp.
FORCEINLINE T* CallocT | ( | size_t | num_elements | ) | [inline] |
Simplified allocation function that allocates the specified number of elements of the given type.
It also explicitly casts it to the requested type.
the memory contains all zero values.
T | the type of the variable(s) to allocation. | |
num_elements | the number of elements to allocate of the given type. |
Definition at line 51 of file alloc_func.hpp.
References MallocError().
void MallocError | ( | size_t | size | ) |
Functions to exit badly with an error message.
It has to be linked so the error messages are not duplicated in each object file making the final binary needlessly large.
Functions to exit badly with an error message.
size | number of bytes we tried to allocate |
Definition at line 12 of file alloc_func.cpp.
References error.
FORCEINLINE T* MallocT | ( | size_t | num_elements | ) | [inline] |
Simplified allocation function that allocates the specified number of elements of the given type.
It also explicitly casts it to the requested type.
the memory contains garbage data (i.e. possibly non-zero values).
T | the type of the variable(s) to allocation. | |
num_elements | the number of elements to allocate of the given type. |
Definition at line 27 of file alloc_func.hpp.
References MallocError().
void ReallocError | ( | size_t | size | ) |
Function to exit with an error message after realloc() have failed.
size | number of bytes we tried to allocate |
Definition at line 21 of file alloc_func.cpp.
References error.
Referenced by ReallocT().
FORCEINLINE T* ReallocT | ( | T * | t_ptr, | |
size_t | num_elements | |||
) | [inline] |
Simplified reallocation function that allocates the specified number of elements of the given type.
It also explicitly casts it to the requested type. It extends/shrinks the memory allocation given in t_ptr.
the memory contains all zero values.
T | the type of the variable(s) to allocation. | |
t_ptr | the previous allocation to extend/shrink. | |
num_elements | the number of elements to allocate of the given type. |
Definition at line 76 of file alloc_func.hpp.
References ReallocError().
Referenced by OldMemoryPoolBase::AddBlockToPool(), AllocateSpecToStation(), AssignWidgetToWindow(), DeallocateSpecFromStation(), FiosAlloc(), GenerateVehicleSortList(), ini_load(), MakeSortedIndustryList(), SetCustomStationSpec(), and ShowPlayerStations().