This commit is contained in:
Jack Halford 2017-03-31 18:38:57 +02:00
parent ba772aeb91
commit 95a51bc94c
4 changed files with 33 additions and 18 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */ /* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
/* Updated: 2017/03/26 17:07:15 by jhalford ### ########.fr */ /* Updated: 2017/03/28 10:58:15 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -21,6 +21,7 @@
# include <sys/xattr.h> # include <sys/xattr.h>
# include <sys/acl.h> # include <sys/acl.h>
# include "types.h"
# include "error.h" # include "error.h"
# include "color.h" # include "color.h"
# include "cliopts.h" # include "cliopts.h"
@ -36,12 +37,6 @@
# include "get_next_line.h" # include "get_next_line.h"
# include "sys.h" # include "sys.h"
typedef struct s_stos t_stos;
typedef struct s_stof t_stof;
typedef struct s_itof t_itof;
typedef long long t_type;
typedef long long t_flag;
struct s_stos struct s_stos
{ {
char *key; char *key;

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */ /* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
/* Updated: 2017/03/26 17:08:28 by jhalford ### ########.fr */ /* Updated: 2017/03/28 20:34:27 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,7 +31,7 @@ t_list *ft_lstnew(void const *content, size_t content_size);
void ft_lstdel(t_list **alst, void (*del)(void *, size_t)); void ft_lstdel(t_list **alst, void (*del)(void *, size_t));
void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)); void ft_lstdelone(t_list **alst, void (*del)(void *, size_t));
void ft_lstadd(t_list **alst, t_list *new); void ft_lstadd(t_list **alst, t_list *new);
int ft_lstiter(t_list *lst, int (*f)()); int ft_lstiter(t_list *lst, int (*f)(), void *data);
t_list *ft_lstmap(t_list *lst, void *(*f)(void *)); t_list *ft_lstmap(t_list *lst, void *(*f)(void *));
t_list *ft_lstnew_range(int a, int b); t_list *ft_lstnew_range(int a, int b);

22
libftasm/includes/types.h Normal file
View file

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* types.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/28 10:57:17 by jhalford #+# #+# */
/* Updated: 2017/03/28 10:57:34 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef TYPES_H
# define TYPES_H
typedef struct s_stos t_stos;
typedef struct s_stof t_stof;
typedef struct s_itof t_itof;
typedef long long t_type;
typedef long long t_flag;
#endif

View file

@ -6,19 +6,17 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:19 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:19 by jhalford #+# #+# */
/* Updated: 2017/03/11 16:17:43 by jhalford ### ########.fr */ /* Updated: 2017/03/28 11:27:45 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "libft.h" #include "libft.h"
int ft_lstiter(t_list *lst, int (*f)()) int ft_lstiter(t_list *lst, int (*f)(), void *data)
{ {
while (lst) if (!lst)
{
if ((*f)(lst->content))
return (1);
lst = lst->next;
}
return (0); return (0);
if ((*f)(lst->content, data))
return (1);
return (ft_lstiter(lst->next, f, data));
} }