Put the custom allocator in its own lib, as to lessen the difficulty to switch between libc's allocator and a custom one (#7)
This commit is contained in:
parent
713f0f0302
commit
cb7f3c3fdf
85 changed files with 1121 additions and 877 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/04 18:32:50 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/10 21:48:31 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/14 18:46:13 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#include "me/string/str_compare.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_str.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static void _hash_str(t_hasher *hasher, t_str *s)
|
||||
|
|
@ -62,7 +63,7 @@ t_error build_envp(t_hashmap_env *envs, t_vec_str *envp)
|
|||
{
|
||||
struct s_build_envp_state state;
|
||||
|
||||
state.out = vec_str_new(envs->num_buckets, (void (*)(t_str))me_free);
|
||||
state.out = vec_str_new(envs->num_buckets, (void (*)(t_str))mem_free);
|
||||
state.buf = alloc_new_buffer(50);
|
||||
if (hashmap_env_iter(envs, _build_envp_iterator, &state))
|
||||
return (ERROR);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ t_error handle_command(t_node *self, t_utils *shcat, t_i32 *out_exit_code)
|
|||
t_spawn_info spawn_info;
|
||||
t_str tmp;
|
||||
|
||||
spawn_info.arguments = vec_str_new(self->childs_count, (void (*)(t_str))me_free);
|
||||
spawn_info.arguments = vec_str_new(self->childs_count, (void (*)(t_str))mem_free);
|
||||
if (self->kind != sym_command)
|
||||
return (ERROR);
|
||||
i = 0;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ t_error handle_concat(t_node *self, t_utils *shcat, t_str *ret)
|
|||
if (node_get_string(&self->childs[i], shcat, &tmp))
|
||||
return (str_free(out), ERROR);
|
||||
push_str_buffer(&out, tmp);
|
||||
me_free(tmp);
|
||||
mem_free(tmp);
|
||||
i++;
|
||||
}
|
||||
*ret = out.buf;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/08 19:07:54 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/14 18:46:30 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
#include "app/env.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
|
||||
#include "me/alloc/alloc_internal.h"
|
||||
|
||||
void ts_parser_delete(t_first_parser *self);
|
||||
|
||||
|
|
@ -50,6 +49,5 @@ void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
|
|||
{
|
||||
if (maiboyerlpb != NULL)
|
||||
ft_free_utils(maiboyerlpb);
|
||||
print_pages_info();
|
||||
me_exit(exit_status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "app/node/handle_program.h"
|
||||
#include "app/signal_handler.h"
|
||||
#include "gmr/symbols.h"
|
||||
#include "me/alloc/alloc.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/string/str_len.h"
|
||||
#include "minishell.h"
|
||||
#include "parser/api.h"
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ void free_node(t_node self)
|
|||
t_usize idx;
|
||||
|
||||
if (self.single_str)
|
||||
me_free(self.single_str);
|
||||
mem_free(self.single_str);
|
||||
idx = 0;
|
||||
while (idx < self.childs_count)
|
||||
free_node(self.childs[idx++]);
|
||||
if (self.childs_count != 0)
|
||||
me_free(self.childs);
|
||||
mem_free(self.childs);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue