From a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 26 Apr 2020 15:07:36 +0200 Subject: ; end bug fix --- src/ft_p_line.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/ft_p_line.c') diff --git a/src/ft_p_line.c b/src/ft_p_line.c index 81e02d2..07c5fac 100644 --- a/src/ft_p_line.c +++ b/src/ft_p_line.c @@ -23,18 +23,22 @@ void ft_p_line(char line[], t_msh *msh) { - uint64_t i; + char *ptr; uint64_t count; - i = 0; count = 0; - while (line[i] != '\0') + ptr = line; + while (*ptr != '\0') { - if (line[i] == ';') + if (*ptr == ';') { - count++; + count += 1; } - i++; + ptr++; + } + if (*(ptr - 1) == ';') + { + count -= 1; } if (ft_p_lcom(line, count, msh) < 0) { -- cgit v1.2.3