Change string writting functions to accept const
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 8 Mar 2024 23:13:13 +0000 (00:13 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 8 Mar 2024 23:13:13 +0000 (00:13 +0100)
This change is done because the writting functions do not (to my
knowledge) change the input string so it can as well be const.

ft_io/ft_putendl_fd.c
ft_io/ft_putstr_fd.c
inc/ft_io.h

index 5e7bff9b315f22be53914efdaf3691da8b5c1349..23fa343155bb5304faca80ce36b4a5556ff50cda 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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 <unistd.h>
 
-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);
index 812abb2268c3c71635f0d5aef0ef5d14d10ecc28..9158b1279166eada9e94835e9713b7b6cd6c7a39 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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 <unistd.h>
 
-void   ft_putstr_fd(char *s, int fd)
+void   ft_putstr_fd(const char *s, int fd)
 {
        if (s == NULL)
                return ;
index a081002e3581dc5bcbc3e0475dc6866d3810224c..754217929a034a243b7b1a9028c5808d71efce4b 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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 <stdarg.h>
 
 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, ...);