Skip to content

Commit

Permalink
Added ft_memclear to for function pairing with ft_lstclear
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Yeow committed Apr 5, 2024
1 parent f85edea commit b28971d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ MEMSRC = \
bzero \
calloc \
memchr \
memclear \
memcmp \
memcpy \
memmove \
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ TODOs:
1. Add get_next_line
2. Add ft_printf
3. Error management for the functions.
4. Add a free function for ft_split.
3 changes: 2 additions & 1 deletion includes/libft.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: myeow <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/15 16:11:56 by myeow #+# #+# */
/* Updated: 2024/04/05 19:04:15 by myeow ### ########.fr */
/* Updated: 2024/04/05 20:29:48 by myeow ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -15,6 +15,7 @@

# include <stddef.h>

void ft_memclear(void *content);
char *ft_strendptr(char *str);
int ft_isspace(int c);
int ft_isalpha(int c);
Expand Down
22 changes: 22 additions & 0 deletions srcs/mem_utils/ft_memclear.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: myeow <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/05 20:26:45 by myeow #+# #+# */
/* Updated: 2024/04/05 20:30:52 by myeow ### ########.fr */
/* */
/* ************************************************************************** */

#include <stdlib.h>

/*
* Pair this with ft_lstclear.
*/
void ft_memclear(void *content)
{
free(content);
return ;
}
4 changes: 3 additions & 1 deletion srcs/str_utils/ft_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
/* By: myeow <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/17 23:18:06 by myeow #+# #+# */
/* Updated: 2024/04/05 20:08:21 by myeow ### ########.fr */
/* Updated: 2024/04/05 20:17:02 by myeow ### ########.fr */
/* */
/* ************************************************************************** */

#include <stdlib.h>

void ft_free_ft_split(char **str_array);

static int ft_countwords(char const *s, char c)
{
size_t n;
Expand Down

0 comments on commit b28971d

Please sign in to comment.