add: tablen function & fix: ft_strcmp now take const char *
This commit is contained in:
parent
baab9b52cd
commit
f25286f41f
@ -6,13 +6,13 @@
|
|||||||
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
|
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
|
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
|
||||||
# Updated: 2023/01/19 12:55:43 by cchauvet ### ########.fr #
|
# Updated: 2023/04/26 12:14:25 by cchauvet ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
CC = clang
|
CC = clang
|
||||||
|
|
||||||
SRCS = ft_contain_only.c ft_freer.c ft_is_in.c ft_random_generator.c ft_strchri.c ft_strcmp.c ft_strfjoin.c ft_strgen.c ft_strmerger.c ft_strndup.c ft_tabrealloc.c ft_ultoa_base.c ft_swap.c
|
SRCS = ft_contain_only.c ft_freer.c ft_is_in.c ft_random_generator.c ft_strchri.c ft_strcmp.c ft_strfjoin.c ft_strgen.c ft_strmerger.c ft_strndup.c ft_tabrealloc.c ft_ultoa_base.c ft_swap.c ft_tablen.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
|
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/01/19 17:35:09 by cchauvet ### ########.fr */
|
/* Updated: 2023/04/26 12:24:00 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,6 +18,7 @@
|
|||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# include "../libft/libft.h"
|
# include "../libft/libft.h"
|
||||||
|
|
||||||
|
size_t ft_tablen(const char **tab);
|
||||||
char *ft_ultoa_base(unsigned long long n, char *base);
|
char *ft_ultoa_base(unsigned long long n, char *base);
|
||||||
char *get_next_line(int fd);
|
char *get_next_line(int fd);
|
||||||
size_t ft_random_generator(size_t start, size_t stop);
|
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);
|
ssize_t ft_strchri(char *str, char c);
|
||||||
int ft_contain_only_str(char *str, char *to_find);
|
int ft_contain_only_str(char *str, char *to_find);
|
||||||
int ft_contain_only(char *str, char c);
|
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(void *a, void *b);
|
||||||
void ft_swap_int(int *a, int *b);
|
void ft_swap_int(int *a, int *b);
|
||||||
void ft_swap_char(char *a, char *b);
|
void ft_swap_char(char *a, char *b);
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/04 19:20:47 by cchauvet #+# #+# */
|
/* Created: 2023/01/04 19:20:47 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/01/05 13:20:20 by cchauvet ### ########.fr */
|
/* Updated: 2023/04/26 12:23:52 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "extra.h"
|
#include "extra.h"
|
||||||
|
|
||||||
int ft_strcmp(char *s1, char *s2)
|
int ft_strcmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
23
libftx/extra/ft_tablen.c
Normal file
23
libftx/extra/ft_tablen.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_tablen.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/26 12:12:19 by cchauvet #+# #+# */
|
||||||
|
/* Updated: 2023/04/26 12:13:38 by cchauvet ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "./extra.h"
|
||||||
|
|
||||||
|
size_t ft_tablen(const char **tab)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (tab[i] != NULL)
|
||||||
|
i++;
|
||||||
|
return (i);
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/21 13:28:19 by cchauvet ### ########.fr */
|
/* Updated: 2023/04/26 12:22:51 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,6 +17,7 @@
|
|||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
# include "./libft/libft.h"
|
# include "./libft/libft.h"
|
||||||
|
|
||||||
|
size_t ft_tablen(const char **tab);
|
||||||
char *ft_ultoa_base(unsigned long long n, char *base);
|
char *ft_ultoa_base(unsigned long long n, char *base);
|
||||||
int ft_printf(const char *format, ...);
|
int ft_printf(const char *format, ...);
|
||||||
int ft_eprintf(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);
|
int ft_contain_only(char *str, char c);
|
||||||
char *ft_strfjoin(char *s1, char *s2);
|
char *ft_strfjoin(char *s1, char *s2);
|
||||||
char *ft_strmerger(size_t arg_len, ...);
|
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);
|
ssize_t ft_strchri(char *str, char c);
|
||||||
char *ft_strndup(const char *src, size_t n);
|
char *ft_strndup(const char *src, size_t n);
|
||||||
void ft_swap(void *a, void *b);
|
void ft_swap(void *a, void *b);
|
||||||
|
Loading…
Reference in New Issue
Block a user