aboutsummaryrefslogtreecommitdiff
path: root/libft/src/vec/ft_vecpush_safe.c
blob: 8e5a8d415a62853123392187f4461b5c70b71f1a (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_vecpush_safe.c                                  :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   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));
}