fix(ft_split): remame strnchr to strnotchr to be more clear
This commit is contained in:
parent
cb20965d6f
commit
607717efc4
1 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/17 16:09:01 by kcolin #+# #+# */
|
/* Created: 2024/10/17 16:09:01 by kcolin #+# #+# */
|
||||||
/* Updated: 2024/10/17 16:50:01 by kcolin ### ########.fr */
|
/* Updated: 2024/10/23 12:20:51 by kcolin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ static size_t count_segments(char const *s, char c)
|
||||||
return (count);
|
return (count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *ft_strnchr(const char *s, int c)
|
static char *ft_strnotchr(const char *s, int c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ char **ft_split(char const *s, char c)
|
||||||
out_idx = 0;
|
out_idx = 0;
|
||||||
while (out_idx < count_segments(s, c))
|
while (out_idx < count_segments(s, c))
|
||||||
{
|
{
|
||||||
s_idx = ft_strnchr(s + s_idx, c) - s;
|
s_idx = ft_strnotchr(s + s_idx, c) - s;
|
||||||
length = ft_strchr(s + s_idx, c) - s - s_idx;
|
length = ft_strchr(s + s_idx, c) - s - s_idx;
|
||||||
out[out_idx] = ft_substr(s, s_idx, length);
|
out[out_idx] = ft_substr(s, s_idx, length);
|
||||||
if (out[out_idx] == NULL)
|
if (out[out_idx] == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue