sstrcat fix
This commit is contained in:
parent
e0af98efbd
commit
d1a2d83d21
2 changed files with 3 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ t_list *ft_lst_find(t_list *begin_list, void *data_ref, int (*cmp)())
|
||||||
list_ptr = begin_list;
|
list_ptr = begin_list;
|
||||||
while (list_ptr)
|
while (list_ptr)
|
||||||
{
|
{
|
||||||
if ((*cmp)(list_ptr->content, data_ref) == 0)
|
if ((cmp)(list_ptr->content, data_ref) == 0)
|
||||||
return (list_ptr);
|
return (list_ptr);
|
||||||
list_ptr = list_ptr->next;
|
list_ptr = list_ptr->next;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@ char *ft_sstrcat(char **sstr, char sep)
|
||||||
len += ft_strlen(sstr[i++]);
|
len += ft_strlen(sstr[i++]);
|
||||||
if (!(out = ft_strnew(sizeof(char) * (len + i + 1))))
|
if (!(out = ft_strnew(sizeof(char) * (len + i + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
ft_strcat(out, sstr[0]);
|
ft_strcpy(out, sstr[0]);
|
||||||
i = 1;
|
i = 1;
|
||||||
while (sstr[i])
|
while (sstr[i])
|
||||||
{
|
{
|
||||||
ft_strcat(out, (char[]){sep, 0});
|
ft_strcat(out, (char[]){sep, 0});
|
||||||
ft_strcat(out, sstr[i]);
|
ft_strcat(out, sstr[i++]);
|
||||||
}
|
}
|
||||||
return (out);
|
return (out);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue