copy on git
This commit is contained in:
commit
42653de246
205 changed files with 7459 additions and 0 deletions
42
libft/ft_split2.c
Normal file
42
libft/ft_split2.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_split2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/09 15:37:07 by alier #+# #+# */
|
||||
/* Updated: 2025/02/16 19:04:33 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* Free all strings duplicated by split and the pointer array itself.
|
||||
* Does nothing if strs is NULL.
|
||||
*/
|
||||
void ft_free_split(char **strs)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (strs == NULL)
|
||||
return ;
|
||||
i = 0;
|
||||
while (strs[i] != NULL)
|
||||
{
|
||||
free(strs[i]);
|
||||
i++;
|
||||
}
|
||||
free(strs);
|
||||
}
|
||||
|
||||
size_t ft_split_size(char **strs)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
while (strs[i] != NULL)
|
||||
i++;
|
||||
return (i);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue