id.c
This commit is contained in:
parent
ee9d9bfabb
commit
30f3606561
4 changed files with 11 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ typedef struct s_btree t_btree;
|
|||
typedef struct s_printdata t_printdata;
|
||||
|
||||
t_btree *btree_create_node(void const *item, size_t content_size);
|
||||
t_btree *btree_map(t_btree *root, void *(*f)(void *))
|
||||
void btree_insert_data(
|
||||
t_btree **root,
|
||||
void *item,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ************************************************************************** */ /* */
|
||||
/* ::: :::::::: */
|
||||
/* math.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
|
|
@ -33,5 +32,6 @@ size_t ft_lllen(long long n);
|
|||
size_t ft_lllen_base(long long n, int base);
|
||||
|
||||
int ft_addrcmp(void *a, void *b);
|
||||
void *id(void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "btree.h"
|
||||
|
||||
t_btree *btree_map(t_btree *root, void *(*f)(void *item))
|
||||
t_btree *btree_map(t_btree *root, void *(*f)(void *))
|
||||
{
|
||||
t_btree *new;
|
||||
|
||||
if (!root)
|
||||
return (NULL);
|
||||
new = btree_create_node(root->item, root->content_size);
|
||||
new->item = (*f)(root->item);
|
||||
new->item = (*f)(new->item);
|
||||
new->left = btree_map(root->left, f);
|
||||
new->right = btree_map(root->right, f);
|
||||
return (new);
|
||||
|
|
|
|||
6
libft/src/math/id.c
Normal file
6
libft/src/math/id.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "libft.h"
|
||||
|
||||
void *id(void *data)
|
||||
{
|
||||
return (data);
|
||||
}
|
||||
Loading…
Reference in a new issue