fix compilation error on newer clang version, fix some norm errors and start doing show_alloc_mem_ex function

This commit is contained in:
2025-02-14 19:38:42 +01:00
parent 561211f709
commit f5b2f8b8bf
14 changed files with 123 additions and 32 deletions

28
srcs/show_alloc_mem_ex.c Normal file
View File

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* show_alloc_mem_ex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/14 17:26:41 by tomoron #+# #+# */
/* Updated: 2025/02/14 17:48:53 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/malloc.h"
void show_alloc_mem_ex(void)
{
size_t total;
total = 0;
pthread_mutex_lock(&g_mallock);
total += show_pre_allocated("TINY", g_allocs.tiny, 1);
total += show_pre_allocated("SMALL", g_allocs.small, 1);
total += show_large(1);
pthread_mutex_unlock(&g_mallock);
write(1, "Total : ", 8);
put_ulnbr_base(total, "0123456789");
write(1, " bytes\n", 7);
}