-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgarbage.h
44 lines (34 loc) · 1.44 KB
/
garbage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* ************************************************************************** */
/* LE - / */
/* / */
/* garbage.h .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: simrossi <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2019/04/10 19:44:25 by simrossi #+# ## ## #+# */
/* Updated: 2019/04/11 10:44:01 by simrossi ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#ifndef GARBAGE_H
# define GARBAGE_H
# include <stdlib.h>
/*
** Macro to use for allocation and free.
*/
# define MALLOC garbage_malloc
# define FREE garbage_free
/*
** Structure of the chained list to store each allocated element.
*/
typedef struct s_garblst t_garblst;
struct s_garblst
{
void *allocated;
t_garblst *next;
};
extern t_garblst *g_garbage;
void garbage_free(void *ptr);
void *garbage_malloc(size_t size);
void free_g_garbage_lst(void) __attribute__((destructor));
#endif