update, and ft_debug first try
This commit is contained in:
parent
da29c5e823
commit
1252d77e02
3 changed files with 17 additions and 5 deletions
12
libftasm/ft_debug.c
Normal file
12
libftasm/ft_debug.c
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "libft.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void ft_debug(void)
|
||||||
|
{
|
||||||
|
static int n = 0;
|
||||||
|
|
||||||
|
n++;
|
||||||
|
ft_putendl("----------");
|
||||||
|
printf(" check %02i\n", n);
|
||||||
|
ft_putendl("----------");
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
t_list *ft_lstnew(void const *content, size_t content_size)
|
t_list *ft_lstnew(void const *content, size_t content_size)
|
||||||
{
|
{
|
||||||
t_list *link;
|
t_list *link;
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (!content)
|
if (!content)
|
||||||
{
|
{
|
||||||
|
|
@ -16,14 +15,13 @@ t_list *ft_lstnew(void const *content, size_t content_size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
link = ft_memalloc(sizeof(t_list) + content_size);
|
link = (t_list *)malloc(sizeof(link));
|
||||||
if (!link)
|
if (!link)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
link->content_size = content_size;
|
link->content_size = content_size;
|
||||||
link->next = NULL;
|
link->next = NULL;
|
||||||
i = -1;
|
link->content = ft_memalloc(content_size);
|
||||||
while (++i < content_size)
|
ft_memcpy(link->content, content, content_size);
|
||||||
((char *)link->content)[i] = ((char *)content)[i];
|
|
||||||
}
|
}
|
||||||
return (link);
|
return (link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ typedef struct s_list
|
||||||
struct s_list *next;
|
struct s_list *next;
|
||||||
} t_list;
|
} t_list;
|
||||||
|
|
||||||
|
void ft_debug(void);
|
||||||
|
|
||||||
void *ft_memset(void *b, int c, size_t len);
|
void *ft_memset(void *b, int c, size_t len);
|
||||||
void ft_bzero(void *s, size_t n);
|
void ft_bzero(void *s, size_t n);
|
||||||
void *ft_memcpy(void *dst, const void *src, size_t n);
|
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue