Added Xalloc_StopOnFail

This commit is contained in:
Alex 2023-03-09 06:42:08 +02:00
parent 69518a172c
commit 8c87037069
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@
typedef long unsigned Xuint64_t;
typedef long unsigned Xsize_t;
#define Xalloc_StopOnFail true
#define Xalloc_PAGE_SIZE PAGE_SIZE
#define Xalloc_trace(m, ...) trace(m, ##__VA_ARGS__)
#define Xalloc_warn(m, ...) warn(m, ##__VA_ARGS__)

View File

@ -150,7 +150,10 @@ namespace Xalloc
{
if (!CurrentBlock->Check())
{
Xalloc_err("Block %#lx checksum failed!", (Xuint64_t)CurrentBlock);
Xalloc_err("Block %#lx has an invalid checksum! (%#x != %#x)",
(Xuint64_t)CurrentBlock, CurrentBlock->Checksum, Xalloc_BlockChecksum);
while (Xalloc_StopOnFail)
;
}
else if (CurrentBlock->IsFree && CurrentBlock->Size >= Size)
{
@ -190,6 +193,8 @@ namespace Xalloc
if (!CurrentBlock->Check())
{
Xalloc_err("Block %#lx checksum failed!", (Xuint64_t)CurrentBlock);
while (Xalloc_StopOnFail)
;
}
else if (CurrentBlock->Address == Address)
{