From c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 11 Oct 2020 15:52:52 +0200 Subject: Removing libft/minishell_test submodules, Removing subject/README/etc --- libft/src/vec/ft_vecpush.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 libft/src/vec/ft_vecpush.c (limited to 'libft/src/vec/ft_vecpush.c') diff --git a/libft/src/vec/ft_vecpush.c b/libft/src/vec/ft_vecpush.c new file mode 100644 index 0000000..026ae3d --- /dev/null +++ b/libft/src/vec/ft_vecpush.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_vecpush.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/01 19:22:20 by charles #+# #+# */ +/* Updated: 2020/04/02 10:51:38 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_vec.h" + +/* +** \brief Push element at the end of vector +** \param vec Vector where element will be pushed +** \param pushed Element to push +** \return Passed vector or NULL if couldnt grow vector +*/ + +t_ftvec *ft_vecpush(t_ftvec *vec, void *pushed) +{ + if (vec->capacity <= vec->size) + if (ft_vecgrow(vec) == NULL) + return (NULL); + vec->data[vec->size] = pushed; + vec->size++; + return (vec); +} -- cgit