From: Lukas Jiriste Date: Fri, 8 Mar 2024 23:13:13 +0000 (+0100) Subject: Change string writting functions to accept const X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=45282f85cbe6209f2476953fef3146b4b65e4eb7;p=Libft.git Change string writting functions to accept const This change is done because the writting functions do not (to my knowledge) change the input string so it can as well be const. --- diff --git a/ft_io/ft_putendl_fd.c b/ft_io/ft_putendl_fd.c index 5e7bff9..23fa343 100644 --- a/ft_io/ft_putendl_fd.c +++ b/ft_io/ft_putendl_fd.c @@ -6,14 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/08/15 16:25:41 by ljiriste #+# #+# */ -/* Updated: 2023/12/09 15:40:38 by ljiriste ### ########.fr */ +/* Updated: 2024/03/09 00:12:24 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_io.h" #include -void ft_putendl_fd(char *s, int fd) +void ft_putendl_fd(const char *s, int fd) { ft_putstr_fd(s, fd); write(fd, "\n", 1); diff --git a/ft_io/ft_putstr_fd.c b/ft_io/ft_putstr_fd.c index 812abb2..9158b12 100644 --- a/ft_io/ft_putstr_fd.c +++ b/ft_io/ft_putstr_fd.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/08/15 16:23:36 by ljiriste #+# #+# */ -/* Updated: 2023/12/09 15:52:36 by ljiriste ### ########.fr */ +/* Updated: 2024/03/08 22:29:23 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ #include "libft.h" #include -void ft_putstr_fd(char *s, int fd) +void ft_putstr_fd(const char *s, int fd) { if (s == NULL) return ; diff --git a/inc/ft_io.h b/inc/ft_io.h index a081002..7542179 100644 --- a/inc/ft_io.h +++ b/inc/ft_io.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/09 11:38:28 by ljiriste #+# #+# */ -/* Updated: 2024/03/05 09:30:28 by ljiriste ### ########.fr */ +/* Updated: 2024/03/09 00:00:58 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,8 +16,8 @@ # include void ft_putchar_fd(char c, int fd); -void ft_putstr_fd(char *s, int fd); -void ft_putendl_fd(char *s, int fd); +void ft_putstr_fd(const char *s, int fd); +void ft_putendl_fd(const char *s, int fd); void ft_putnbr_fd(int n, int fd); int ft_printf(const char *format, ...); int ft_dprintf(int fd, const char *format, ...);