misc: update libtf
This commit is contained in:
parent
1caa74227d
commit
e37b38b1ca
6 changed files with 24 additions and 26 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/18 11:08:16 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/03/11 14:03:06 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/03/12 16:05:15 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
t_memclass mem_newclass(t_err *err)
|
||||
{
|
||||
t_memclass_in r;
|
||||
t_memclass_in *r;
|
||||
|
||||
r = malloc(sizeof(struct s_memclass_in));
|
||||
r = malloc(sizeof(t_memclass_in));
|
||||
if (!r)
|
||||
return ((*err)("alloc error"), NULL);
|
||||
r->first = NULL;
|
||||
|
|
@ -30,9 +30,9 @@ void *mem_alloc(t_err *err, t_memclass mc, size_t size)
|
|||
{
|
||||
void *r;
|
||||
t_element *new_element;
|
||||
t_memclass_in mc_in;
|
||||
t_memclass_in *mc_in;
|
||||
|
||||
mc_in = (t_memclass_in) mc;
|
||||
mc_in = (t_memclass_in *) mc;
|
||||
new_element = malloc(sizeof(t_element));
|
||||
if (!new_element)
|
||||
return ((*err)("alloc error"), NULL);
|
||||
|
|
@ -57,7 +57,7 @@ void mem_freeall(t_memclass mc)
|
|||
|
||||
if (!mc)
|
||||
return ;
|
||||
el = ((t_memclass_in) mc)->first;
|
||||
el = ((t_memclass_in *) mc)->first;
|
||||
while (el)
|
||||
{
|
||||
next = el->next;
|
||||
|
|
@ -68,8 +68,8 @@ void mem_freeall(t_memclass mc)
|
|||
free(el);
|
||||
el = next;
|
||||
}
|
||||
if (((t_memclass_in) mc)->parent_element)
|
||||
freeelement(((t_memclass_in) mc)->parent_element);
|
||||
if (((t_memclass_in *) mc)->parent_element)
|
||||
freeelement(((t_memclass_in *) mc)->parent_element);
|
||||
free(mc);
|
||||
}
|
||||
|
||||
|
|
@ -86,11 +86,11 @@ void mem_free(void *address)
|
|||
|
||||
t_memclass mem_subclass(t_err *err, t_memclass parent)
|
||||
{
|
||||
t_memclass_in r;
|
||||
t_memclass_in parent_in;
|
||||
t_memclass_in *r;
|
||||
t_memclass_in *parent_in;
|
||||
t_element *new_element;
|
||||
|
||||
parent_in = (t_memclass_in) parent;
|
||||
parent_in = (t_memclass_in *) parent;
|
||||
r = mem_newclass(err);
|
||||
if (!r)
|
||||
return (err("alloc error"), NULL);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 14:28:19 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/03/25 14:53:04 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/03/25 14:45:18 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/22 13:39:04 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/02/15 15:28:25 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/09 14:05:13 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ t_string str_dup(t_err err, t_memclass mc, t_const_string str)
|
|||
t_string r;
|
||||
int i;
|
||||
|
||||
r = mem_alloc(err, mc, str_len(str) * sizeof(char));
|
||||
r = mem_alloc(err, mc, (str_len(str) + 1) * sizeof(char));
|
||||
if (!r)
|
||||
return (r);
|
||||
i = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue