From b11980eeca525b55b2ab0c579f74445e9f65cae7 Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 31 Jul 2024 13:00:56 +0200 Subject: [PATCH] print error only in debug mode --- src/malloc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/malloc.c b/src/malloc.c index d48b053..6ec3327 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -122,12 +122,10 @@ void ft_free(void *ptr) for (i = TINY; i <= LARGE + 1; i++) { +#ifndef DEBUG if (i > LARGE) - { - // THROW ERROR write(2, "chunk not found\n", 16); - } - +#endif root = allocs_tree[i]; raw_chunk = raw_get_chunk(root, ptr); @@ -139,11 +137,10 @@ void ft_free(void *ptr) chunk_read(raw_chunk, &chunk); +#ifndef DEBUG if (chunk.is_used == false) - { write(2, "double free\n", 12); - // THROW ERROR - } +#endif // CALL THE RIGHT FREE FUNCTION DEPEND ON SIZE free_funcs[i](&chunk);