Codechange: replace error/usererror printf variant with fmt variant and rename

This commit is contained in:
Rubidium
2023-04-19 22:47:36 +02:00
committed by rubidium42
parent 43c65a3fec
commit f74e26ca7e
39 changed files with 176 additions and 131 deletions

View File

@@ -9,6 +9,8 @@
#include "../stdafx.h"
#include "../error_func.h"
#include "../safeguards.h"
/**
@@ -17,7 +19,7 @@
*/
void NORETURN MallocError(size_t size)
{
error("Out of memory. Cannot allocate " PRINTF_SIZE " bytes", size);
FatalError("Out of memory. Cannot allocate {} bytes", size);
}
/**
@@ -26,5 +28,5 @@ void NORETURN MallocError(size_t size)
*/
void NORETURN ReallocError(size_t size)
{
error("Out of memory. Cannot reallocate " PRINTF_SIZE " bytes", size);
FatalError("Out of memory. Cannot reallocate {} bytes", size);
}

View File

@@ -13,6 +13,7 @@
#include "alloc_func.hpp"
#include "mem_func.hpp"
#include "pool_type.hpp"
#include "../error_func.h"
#include "../saveload/saveload_error.hpp" // SlErrorCorruptFmt
@@ -129,7 +130,7 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index)
* Allocates new item
* @param size size of item
* @return pointer to allocated item
* @note error() on failure! (no free item)
* @note FatalError() on failure! (no free item)
*/
DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
{
@@ -140,7 +141,7 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
this->checked--;
#endif /* WITH_ASSERT */
if (index == NO_FREE_ITEM) {
error("%s: no more free items", this->name);
FatalError("{}: no more free items", this->name);
}
this->first_free = index + 1;