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_safe.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 libft/src/vec/ft_vecpush_safe.c (limited to 'libft/src/vec/ft_vecpush_safe.c') diff --git a/libft/src/vec/ft_vecpush_safe.c b/libft/src/vec/ft_vecpush_safe.c new file mode 100644 index 0000000..8e5a8d4 --- /dev/null +++ b/libft/src/vec/ft_vecpush_safe.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_vecpush_safe.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/04 13:29:48 by charles #+# #+# */ +/* Updated: 2020/04/04 14:24:19 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_vec.h" + +/* +** \brief Wrapper around ft_vecpush which reject null element +** \param vec Pushed vector +** \param pushed Element pushed which can't be NULL +** \return NULL if pushed is NULL, whatever ft_vecpush returns otherwise +*/ + +t_ftvec *ft_vecpush_safe(t_ftvec *vec, void *pushed) +{ + if (pushed == NULL) + return (NULL); + return (ft_vecpush(vec, pushed)); +} -- cgit