Better mem_check reporting

This commit is contained in:
Joel de Vahl 2008-10-07 16:17:58 +00:00
parent c0fa3003d7
commit 2b6f991010
2 changed files with 6 additions and 3 deletions

View file

@ -240,7 +240,7 @@ void mem_zero(void *block,unsigned size)
memset(block, 0, size);
}
void mem_check()
int mem_check_imp()
{
MEMHEADER *header = first;
while(header)
@ -249,10 +249,12 @@ void mem_check()
if(tail->guard != MEM_GUARD_VAL)
{
dbg_msg("mem", "Memory check failed at %s(%d): %d", header->filename, header->line, header->size);
dbg_assert(0, "Memory check failed");
return 0;
}
header = header->next;
}
return 1;
}
IOHANDLE io_open(const char *filename, int flags)

View file

@ -166,7 +166,8 @@ int mem_comp(const void *a, const void *b, int size);
Validates the heap
Will trigger a assert if memory has failed.
*/
void mem_check();
int mem_check_imp();
#define mem_check() dbg_assert_imp(__FILE__, __LINE__, mem_check_imp(), "Memory check failed")
/* Group: File IO */
enum {