Minishell
 
Loading...
Searching...
No Matches
garbage.h File Reference
#include <stdlib.h>
Include dependency graph for garbage.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_element
 Basic node for an element of a linked list. More...
 
struct  s_garbage
 Head of the linked list. More...
 

Functions

void * malloc_gb (t_garbage *garbage, size_t size)
 Replace the original malloc by storing the created adresses into a garbage to remove them afterwards.
 
void add_to_garbage (t_garbage *garbage, void *ptr)
 Add a pointer to the garbage list.
 
void free_element_gb (t_garbage *garbage, void *ptr)
 Free an element in the garbage collector.
 
char * ft_strdup_gb (t_garbage *garbage, const char *source)
 Create a copy of source into a new pointer NEEDS to be freed.
 
void garbage_init (t_garbage *garbage)
 Get the garbage object.
 
void free_garbage (t_garbage *garbage)
 Free the garbage.
 
void print_garbage (t_garbage *garbage)
 Print the garbage collector.
 
t_elementft_garbagenew (void *ptr)
 Allocates and returns the newly created element 'value' is initialised with content 'next' is set to NULL.
 
void ft_garbageadd_front (t_garbage *garbage, t_element *new)
 Adds the 'new' element at the start of stack.
 
void ft_garbageadd_back (t_garbage *stack, t_element *new) __attribute__((deprecated))
 Adds the 'new' element at the end of stack.
 
int ft_garbageclear (t_garbage *data)
 Remove all elements from garbage.