sstrcat fix

This commit is contained in:
Jack Halford 2016-12-12 00:42:20 +01:00
parent a60d17a0b9
commit 78390e5d8c
2 changed files with 3 additions and 3 deletions

View file

@ -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;
} }

View file

@ -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);
} }