From fa72a134a0447950c7b4a2f422e705fc6a0e3852 Mon Sep 17 00:00:00 2001 From: adjoly Date: Sat, 19 Oct 2024 12:14:12 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix(Libft):=20?= =?UTF-8?q?Modified=20a=20little=20libft=20for=20it=20to=20compile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 6 +++--- libft/Ft_Printf/ft_printf_utils.c | 6 +++--- libft/Makefile | 2 +- libft/includes/libft.h | 2 +- libft/put/ft_putchar_fd.c | 4 ++-- libft/put/ft_putendl_fd.c | 6 +++--- libft/put/ft_putstr_fd.c | 13 ++----------- 7 files changed, 15 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index c3e1d8d..f9ecccb 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/10/07 16:02:18 by adjoly #+# #+# # -# Updated: 2024/10/13 21:23:17 by adjoly ### ########.fr # +# Updated: 2024/10/17 01:22:00 by adjoly ### ########.fr # # # # **************************************************************************** # @@ -32,7 +32,7 @@ SRCS = $(shell find src -name *.c) OBJS = $(addprefix $(OBJSDIR), $(SRCS:.c=.o)) -FLAGS = -Wall -Werror -Wextra -g -lm -lSDL2 -MMD -MP +FLAGS = -Wall -Werror -Wextra -g -MMD -MP LIB = libft/libft.a \ MacroLibX/libmlx.so @@ -42,7 +42,7 @@ $(NAME): $(OBJS) @echo "✅ Libft compiled" @#@make -sj -C $(MACRO_DIR) @#@echo "✅ MacroLibX compiled" - @$(CC) $(OBJS) $(LIB) -o $(NAME) $(FLAGS) + @$(CC) $(OBJS) $(LIB) -o $(NAME) $(FLAGS) -lm -lSDL2 @echo "✅ Compiled" $(OBJSDIR)%.o: %.c diff --git a/libft/Ft_Printf/ft_printf_utils.c b/libft/Ft_Printf/ft_printf_utils.c index fc73f4d..8445e5b 100644 --- a/libft/Ft_Printf/ft_printf_utils.c +++ b/libft/Ft_Printf/ft_printf_utils.c @@ -6,7 +6,7 @@ /* By: madumerg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/31 13:02:45 by madumerg #+# #+# */ -/* Updated: 2024/09/04 16:24:48 by madumerg ### ########.fr */ +/* Updated: 2024/10/16 20:58:23 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/put/ft_putchar_fd.c b/libft/put/ft_putchar_fd.c index cf6738b..15ee660 100644 --- a/libft/put/ft_putchar_fd.c +++ b/libft/put/ft_putchar_fd.c @@ -6,7 +6,7 @@ /* By: madumerg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/03 14:32:56 by madumerg #+# #+# */ -/* Updated: 2023/11/03 14:52:19 by madumerg ### ########.fr */ +/* Updated: 2024/10/17 01:13:30 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,5 +14,5 @@ void ft_putchar_fd(char c, int fd) { - write(fd, &c, 1); + (void)write(fd, &c, 1); } diff --git a/libft/put/ft_putendl_fd.c b/libft/put/ft_putendl_fd.c index 54d1ea4..146e95d 100644 --- a/libft/put/ft_putendl_fd.c +++ b/libft/put/ft_putendl_fd.c @@ -6,7 +6,7 @@ /* By: madumerg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/03 14:33:06 by madumerg #+# #+# */ -/* Updated: 2024/04/04 17:11:24 by madumerg ### ########.fr */ +/* Updated: 2024/10/17 01:28:14 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,8 +21,8 @@ void ft_putendl_fd(char *s, int fd) return ; while (s[i] != '\0') { - write(fd, &s[i], 1); + (void)write(fd, &s[i], 1); i++; } - write(fd, "\n", 1); + (void)write(fd, "\n", 1); } diff --git a/libft/put/ft_putstr_fd.c b/libft/put/ft_putstr_fd.c index a352e32..054d748 100644 --- a/libft/put/ft_putstr_fd.c +++ b/libft/put/ft_putstr_fd.c @@ -6,7 +6,7 @@ /* By: madumerg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/03 14:33:15 by madumerg #+# #+# */ -/* Updated: 2023/11/09 16:26:33 by madumerg ### ########.fr */ +/* Updated: 2024/10/17 01:13:01 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,14 +14,5 @@ void ft_putstr_fd(char *s, int fd) { - int i; - - i = 0; - if (!s) - return ; - while (s[i] != '\0') - { - write(fd, &s[i], 1); - i++; - } + (void)write(fd, s, ft_strlen(s)); }