summaryrefslogtreecommitdiffstats
path: root/src/ft_p_line.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_p_line.c16
1 files changed, 10 insertions, 6 deletions
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)
{