From f25286f41f10fb18747330346efa9f44d46d990c Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Wed, 26 Apr 2023 12:25:49 +0000 Subject: [PATCH] add: tablen function & fix: ft_strcmp now take const char * --- libftx/extra/Makefile | 4 ++-- libftx/extra/extra.h | 5 +++-- libftx/extra/ft_strcmp.c | 4 ++-- libftx/extra/ft_tablen.c | 23 +++++++++++++++++++++++ libftx/libftx.h | 5 +++-- 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 libftx/extra/ft_tablen.c diff --git a/libftx/extra/Makefile b/libftx/extra/Makefile index bc967dd..6ae9605 100644 --- a/libftx/extra/Makefile +++ b/libftx/extra/Makefile @@ -6,13 +6,13 @@ # By: cchauvet # include "../libft/libft.h" +size_t ft_tablen(const char **tab); char *ft_ultoa_base(unsigned long long n, char *base); char *get_next_line(int fd); size_t ft_random_generator(size_t start, size_t stop); @@ -32,7 +33,7 @@ char *ft_strndup(const char *src, size_t n); ssize_t ft_strchri(char *str, char c); int ft_contain_only_str(char *str, char *to_find); int ft_contain_only(char *str, char c); -int ft_strcmp(char *s1, char *s2); +int ft_strcmp(const char *s1, const char *s2); void ft_swap(void *a, void *b); void ft_swap_int(int *a, int *b); void ft_swap_char(char *a, char *b); diff --git a/libftx/extra/ft_strcmp.c b/libftx/extra/ft_strcmp.c index 3b7265d..5f8d7b3 100644 --- a/libftx/extra/ft_strcmp.c +++ b/libftx/extra/ft_strcmp.c @@ -6,13 +6,13 @@ /* By: cchauvet # include "./libft/libft.h" +size_t ft_tablen(const char **tab); char *ft_ultoa_base(unsigned long long n, char *base); int ft_printf(const char *format, ...); int ft_eprintf(const char *format, ...); @@ -33,7 +34,7 @@ int ft_contain_only_str(char *str, char *to_find); int ft_contain_only(char *str, char c); char *ft_strfjoin(char *s1, char *s2); char *ft_strmerger(size_t arg_len, ...); -int ft_strcmp(char *s1, char *s2); +int ft_strcmp(const char *s1, const char *s2); ssize_t ft_strchri(char *str, char c); char *ft_strndup(const char *src, size_t n); void ft_swap(void *a, void *b);