Made a memory allocator (crude)
This commit is contained in:
parent
b5c7344851
commit
941bac31b6
53 changed files with 469 additions and 146 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/02 15:05:06 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/02 16:01:52 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 14:59:27 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -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);
|
||||
free(tmp);
|
||||
me_free(tmp);
|
||||
i++;
|
||||
}
|
||||
*ret = out.buf;
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/03 15:24:25 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/04 18:28:39 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 14:55:25 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "app/node/handle_expension.h"
|
||||
#include "gmr/symbols.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
#include "me/types.h"
|
||||
|
||||
t_error handle_expension_complex(t_node *self, t_utils *shcat, t_str *ret)
|
||||
|
|
@ -26,6 +27,7 @@ t_error handle_expension_simple(t_node *self, t_utils *shcat, t_str *ret)
|
|||
(void)(self);
|
||||
(void)(shcat);
|
||||
(void)(ret);
|
||||
//get_hashmap_env(shcat->env, (t_str *)&"fjdksf");
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/04 19:24:44 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 13:00:21 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -39,8 +39,6 @@ void ft_free_utils(t_utils *s)
|
|||
free(s->str_input);
|
||||
if (s->path)
|
||||
ft_free_strs(s->path);
|
||||
if (s->env)
|
||||
drop_hashmap_env(s->env);
|
||||
ts_parser_delete(s->parser.parser);
|
||||
}
|
||||
|
||||
|
|
@ -48,5 +46,5 @@ void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
|
|||
{
|
||||
if (maiboyerlpb != NULL)
|
||||
ft_free_utils(maiboyerlpb);
|
||||
exit(exit_status);
|
||||
me_exit(exit_status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/04 19:21:16 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 13:08:24 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ void print_node_data(t_node *t, t_usize depth)
|
|||
while (idx++ < depth)
|
||||
printf("\t");
|
||||
idx = 0;
|
||||
printf("%s(%llu) = %s\n", t->kind_str, t->kind, node_getstr(t));
|
||||
printf("%s(%lu) = %s\n", t->kind_str, t->kind, node_getstr(t));
|
||||
while (idx < t->childs_count)
|
||||
print_node_data(&t->childs[idx++], depth + 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/30 16:43:35 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 12:51:18 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -82,12 +82,13 @@ t_str node_getstr(t_node *node)
|
|||
|
||||
void free_node(t_node t)
|
||||
{
|
||||
t_usize idx;
|
||||
|
||||
idx = 0;
|
||||
while (idx < t.childs_count)
|
||||
free_node(t.childs[idx++]);
|
||||
free(t.childs);
|
||||
if (t.single_str != NULL)
|
||||
free(t.single_str);
|
||||
// t_usize idx;
|
||||
//
|
||||
// idx = 0;
|
||||
// while (idx < t.childs_count)
|
||||
// free_node(t.childs[idx++]);
|
||||
// free(t.childs);
|
||||
// if (t.single_str != NULL)
|
||||
// free(t.single_str);
|
||||
(void)(t);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue