print error only in debug mode

This commit is contained in:
starnakin 2024-07-31 13:00:56 +02:00
parent 6738b0f5bb
commit b11980eeca

View File

@ -122,12 +122,10 @@ void ft_free(void *ptr)
for (i = TINY; i <= LARGE + 1; i++) for (i = TINY; i <= LARGE + 1; i++)
{ {
#ifndef DEBUG
if (i > LARGE) if (i > LARGE)
{
// THROW ERROR
write(2, "chunk not found\n", 16); write(2, "chunk not found\n", 16);
} #endif
root = allocs_tree[i]; root = allocs_tree[i];
raw_chunk = raw_get_chunk(root, ptr); raw_chunk = raw_get_chunk(root, ptr);
@ -139,11 +137,10 @@ void ft_free(void *ptr)
chunk_read(raw_chunk, &chunk); chunk_read(raw_chunk, &chunk);
#ifndef DEBUG
if (chunk.is_used == false) if (chunk.is_used == false)
{
write(2, "double free\n", 12); write(2, "double free\n", 12);
// THROW ERROR #endif
}
// CALL THE RIGHT FREE FUNCTION DEPEND ON SIZE // CALL THE RIGHT FREE FUNCTION DEPEND ON SIZE
free_funcs[i](&chunk); free_funcs[i](&chunk);