add MALLOC_DEBUG_LEVEL environment variable support
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/30 16:55:48 by tomoron #+# #+# */
|
||||
/* Updated: 2024/11/30 11:34:40 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/12/09 17:45:01 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include "./ft_printf.h"
|
||||
# include "../../libft/ft_printf/ft_printf.h"
|
||||
|
||||
typedef struct s_list
|
||||
{
|
||||
@ -45,6 +45,7 @@ void ft_lstadd_front(t_list **lst, t_list *new);
|
||||
char **ft_split(char const *str, char charset);
|
||||
void ft_lstadd_back(t_list **lst, t_list *new);
|
||||
char **ft_split_set(char *str, char *charset);
|
||||
void ft_putulnbr_fd(unsigned long n, int fd);
|
||||
int ft_str_is_only_char(char *str, char c);
|
||||
void *ft_memset(void *s, int c, size_t n);
|
||||
char *ft_get_color(int r, int g, int b);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/26 16:38:01 by tomoron #+# #+# */
|
||||
/* Updated: 2024/12/05 16:39:23 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/12/09 17:53:13 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
# include <pthread.h>
|
||||
# include <stdint.h>
|
||||
# include <fcntl.h>
|
||||
# include "libft.h"
|
||||
|
||||
# define PAGE_SIZE sysconf(_SC_PAGESIZE)
|
||||
@ -46,8 +48,18 @@ typedef struct s_allocations
|
||||
t_mem_chunk *tiny;
|
||||
t_mem_chunk *small;
|
||||
t_alloc *large;
|
||||
|
||||
short log_level;
|
||||
int fd;
|
||||
} t_allocations;
|
||||
|
||||
typedef struct t_settings
|
||||
{
|
||||
uint8_t debug_level:2;
|
||||
uint8_t show_leaks:1;
|
||||
uint8_t initialized:1;
|
||||
} t_settings; //size 1
|
||||
|
||||
typedef unsigned long t_ul;
|
||||
|
||||
extern t_allocations g_allocs;
|
||||
@ -55,9 +67,12 @@ extern pthread_mutex_t g_mallock;
|
||||
|
||||
size_t align(size_t nb, size_t align_nb);
|
||||
|
||||
void *malloc(size_t size);
|
||||
void show_alloc_mem(void);
|
||||
void free(void *ptr);
|
||||
void *realloc(void *ptr, size_t size);
|
||||
void *malloc(size_t size);
|
||||
t_settings *get_settings();
|
||||
void show_alloc_mem(void);
|
||||
void free(void *ptr);
|
||||
void *realloc(void *ptr, size_t size);
|
||||
void log_str(char *str, int level, int print_level, int nl);
|
||||
void log_ul(unsigned long nb, int level, int print_level, int nl);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user