aboutsummaryrefslogtreecommitdiff
path: root/libft/src/vec/ft_vecfrom_lst.c
blob: 4a16e4c5f952cc03609332cd38849b335696ac40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_vecfrom_lst.c                                   :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/06/14 15:59:24 by charles           #+#    #+#             */
/*   Updated: 2020/06/15 09:48:48 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft_vec.h"

t_ftvec	*ft_vecfrom_lst(t_ftlst *lst)
{
	t_ftvec	*vec;
	t_ftlst	*curr;

	if ((vec = ft_vecnew(ft_lstsize(lst))) == NULL)
		return (NULL);
	curr = lst;
	while (curr != NULL)
	{
		ft_vecpush(vec, curr->data);
		curr = curr->next;
	}
	return (vec);
}