From 99697d949e55323411dc8484183dc4f3518c6aab Mon Sep 17 00:00:00 2001 From: Thomas Rieg Date: Mon, 8 Dec 2025 16:02:47 +0100 Subject: [PATCH] added comments --- main_bonus.c | 4 ++-- srcs/ft_malloc.c | 2 +- srcs/ft_realloc.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main_bonus.c b/main_bonus.c index f19cf6d..947ee0e 100644 --- a/main_bonus.c +++ b/main_bonus.c @@ -6,7 +6,7 @@ /* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/11/28 17:23:45 by thrieg #+# #+# */ -/* Updated: 2025/12/08 14:22:46 by thrieg ### ########.fr */ +/* Updated: 2025/12/08 15:52:17 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,7 +36,7 @@ int main(void) free(c); write(1, "\n\n\n\n\nafter free: \n\n\n\n\n", sizeof("\n\n\n\n\nafter free: \n\n\n\n\n") - 1); - show_alloc_mem_ex(false); + show_alloc_mem_ex(true); a = malloc(20); b = malloc(1000); diff --git a/srcs/ft_malloc.c b/srcs/ft_malloc.c index 6c30840..1dd395d 100644 --- a/srcs/ft_malloc.c +++ b/srcs/ft_malloc.c @@ -6,7 +6,7 @@ /* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/11/17 15:02:55 by thrieg #+# #+# */ -/* Updated: 2025/12/08 15:37:27 by thrieg ### ########.fr */ +/* Updated: 2025/12/08 16:02:22 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/ft_realloc.c b/srcs/ft_realloc.c index 4776ddc..418b10f 100644 --- a/srcs/ft_realloc.c +++ b/srcs/ft_realloc.c @@ -6,7 +6,7 @@ /* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/11/25 11:47:23 by thrieg #+# #+# */ -/* Updated: 2025/12/08 15:37:18 by thrieg ### ########.fr */ +/* Updated: 2025/12/08 16:02:18 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ @@ -102,7 +102,7 @@ void *realloc(void *ptr, size_t size) { header->size = available_space; } - pthread_mutex_unlock(&g_mut); + pthread_mutex_unlock(&g_mut); // doesn't need to stay locked because the user is not supposed to free or realloc this ptr or change its content before this realloc returns if (g_state.patern) ft_memset((char *)ptr + original_space, g_state.patern, header->size - original_space); // should I use original_size to only perturb the actually requested bytes instead of the bytes I allocate? return (ptr);