aboutsummaryrefslogtreecommitdiff
path: root/src/str/ft_strsdestroy.c
blob: bb2204c30a636aa4796b6301ea4c66aa9e93e97a (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
30
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strsdestroy.c                                   :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/27 16:30:55 by cacharle          #+#    #+#             */
/*   Updated: 2020/05/11 15:53:49 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft_str.h"

/*
** \brief       Destroy a NULL-terminated array of malloc'd string
** \param strs  Strings to destroy
** \return      NULL (so that it can be used in return statement)
*/

void	*ft_strsdestroy(char **strs)
{
	int	i;

	i = -1;
	while (strs[++i] != NULL)
		free(strs[i]);
	free(strs);
	return (NULL);
}