Codefix: [NewGRF] Don't read an extended byte into uint8_t. (#13302)
[openttd-github.git] / src / core / alloc_func.cpp
blob00f9ecdb1a71d6c1dbc091ffb3f50d418b2e1b60
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file alloc_func.cpp Functions to 'handle' memory allocation errors */
10 #include "../stdafx.h"
12 #include "../error_func.h"
14 #include "../safeguards.h"
16 /**
17 * Function to exit with an error message after malloc() or calloc() have failed
18 * @param size number of bytes we tried to allocate
20 [[noreturn]] void MallocError(size_t size)
22 FatalError("Out of memory. Cannot allocate {} bytes", size);
25 /**
26 * Function to exit with an error message after realloc() have failed
27 * @param size number of bytes we tried to allocate
29 [[noreturn]] void ReallocError(size_t size)
31 FatalError("Out of memory. Cannot reallocate {} bytes", size);