From 0289baf5351f0bb06a5777e31800ab06d88f3fb0 Mon Sep 17 00:00:00 2001 From: Adam JOLY Date: Thu, 14 Mar 2024 16:19:34 +0100 Subject: [PATCH] fixed libft --- Makefile | 4 ++-- libft.h | 3 ++- print/printf/ft_putstr.c | 5 +---- str/ft_strlen.c | 15 ++++++--------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 195967a..5dbe0ca 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,13 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/01 11:03:22 by adjoly #+# #+# # -# Updated: 2024/03/12 14:36:06 by adjoly ### ########.fr # +# Updated: 2024/03/12 15:04:46 by adjoly ### ########.fr # # # # **************************************************************************** # NAME = libft.a -CC = cc +CC = clang OBJSDIR = obj/ diff --git a/libft.h b/libft.h index 7f1d449..997860b 100644 --- a/libft.h +++ b/libft.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */ -/* Updated: 2024/03/04 09:06:35 by adjoly ### ########.fr */ +/* Updated: 2024/03/12 14:43:11 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -99,4 +99,5 @@ int ft_putnbrbase_pf(unsigned int n, char *base); int ft_putchar_p(char c); int ft_putnbr_p(int n); size_t ft_strlen(const char *s); + #endif diff --git a/print/printf/ft_putstr.c b/print/printf/ft_putstr.c index efb8f01..ef55877 100644 --- a/print/printf/ft_putstr.c +++ b/print/printf/ft_putstr.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */ -/* Updated: 2024/02/04 15:23:52 by adjoly ### ########.fr */ +/* Updated: 2024/03/12 15:05:16 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,9 +14,6 @@ int ft_putstr_p(char *s) { - int i; - - i = 0; if (s == NULL) { write(1, "(null)", 6); diff --git a/str/ft_strlen.c b/str/ft_strlen.c index 879d7eb..7583bac 100644 --- a/str/ft_strlen.c +++ b/str/ft_strlen.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/30 18:15:57 by adjoly #+# #+# */ -/* Updated: 2024/02/04 15:10:15 by adjoly ### ########.fr */ +/* Updated: 2024/03/12 15:07:08 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,13 +14,10 @@ size_t ft_strlen(const char *s) { - size_t i; + const char *tmp; - i = 0; - while (*s) - { - s++; - i++; - } - return (i); + tmp = s; + while (*tmp) + tmp++; + return (tmp - s); }