2019-04-24 20:59:37 +03:00
|
|
|
#ifndef FT_MALLOC_H
|
|
|
|
# define FT_MALLOC_H
|
|
|
|
|
2019-04-26 12:55:55 +03:00
|
|
|
# include <stddef.h>
|
|
|
|
# include <stdint.h>
|
2019-04-24 20:59:37 +03:00
|
|
|
|
2019-04-26 22:18:34 +03:00
|
|
|
# define MIN_ALLOC_UNITS 100
|
|
|
|
|
2019-04-26 12:55:55 +03:00
|
|
|
typedef struct s_header
|
|
|
|
{
|
|
|
|
struct s_header *next;
|
2019-04-26 13:59:34 +03:00
|
|
|
size_t units;
|
2019-04-26 12:55:55 +03:00
|
|
|
} t_header;
|
|
|
|
|
2019-04-26 22:18:34 +03:00
|
|
|
# define UINIT (sizeof(t_header))
|
|
|
|
|
|
|
|
|
2019-04-26 12:55:55 +03:00
|
|
|
static t_header base;
|
2019-04-26 22:18:34 +03:00
|
|
|
static t_header *free_blocks = NULL;
|
2019-04-26 12:55:55 +03:00
|
|
|
|
|
|
|
void free(void *ptr);
|
|
|
|
void *malloc(size_t size);
|
|
|
|
void *realloc(void *ptr, size_t size);
|
2019-04-24 20:59:37 +03:00
|
|
|
|
|
|
|
#endif
|