Пример #1
0
void	add_r_dir(t_dir *dir, char *full_path, char **tab)
{
	t_dir	*r_dir;

	r_dir = set_dir_name(full_path, dir->ls);
	r_dir->is_rr = 1;
	r_dir->modif_date = ft_atod(tab[6]);
	if ((dir->ls)->t)
		ft_btree_insert(&dir->rr_dir, r_dir, dir_date_comp);
	else
		ft_btree_insert(&dir->rr_dir, r_dir, dir_name_comp);
}
Пример #2
0
void		ft_map_insert(t_map map, t_map_entry entry, t_simple_hash_func h_f)
{
	t_btree	*node;

	entry.hash_ = h_f(entry.key);
	node = ft_btree_new(&entry, sizeof(t_map_entry));
	ft_btree_insert(&map[entry.hash_ % MAP_TREE_SIZE], node, insert_cmp);
}
Пример #3
0
static void	rebuild_tree(t_btree *n, t_btree *i, t_btree **r, t_comparator cmp)
{
	t_btree	*left;
	t_btree	*right;

	if (n)
	{
		left = n->left;
		right = n->right;
		n->left = 0;
		n->right = 0;
		if (n != i)
			ft_btree_insert(r, n, cmp);
		rebuild_tree(left, i, r, cmp);
		rebuild_tree(right, i, r, cmp);
	}
}