fix(ft_strsplit): compile error

This commit is contained in:
gbrochar 2024-10-05 11:27:17 +02:00
parent 1ab0cdf1ac
commit 88ac06645f
1 changed files with 7 additions and 4 deletions

View File

@ -47,10 +47,12 @@ static void *ft_taballoc(char const *s, char **str_tab, char c)
wl++;
i++;
}
if (wl != 0)
*str_tab++ = (char *)malloc((wl + 1) * sizeof(char));
if (!(str_tab - 1))
return (NULL);
if (wl != 0) {
*str_tab = (char *)malloc((wl + 1) * sizeof(char));
if (!str_tab)
return (NULL);
str_tab++;
}
}
return (*str_tab);
}
@ -83,3 +85,4 @@ char **ft_strsplit(char const *s, char c)
str_tab[i] = NULL;
return (str_tab);
}