-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_strljoin.c
39 lines (36 loc) · 1.25 KB
/
ft_strljoin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strljoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ydeineha <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/09/05 21:28:44 by ydeineha #+# #+# */
/* Updated: 2018/09/05 21:28:47 by ydeineha ### ########.fr */
/* */
/* ************************************************************************** */
#include "corewar.h"
char *ft_strljoin(char **s1, char **s2)
{
char *without_leaks;
without_leaks = NULL;
if (!s1 && !s2)
return (NULL);
else if (!*s1 && *s2)
{
without_leaks = *s2;
*s2 = NULL;
}
else if (!*s2 && *s1)
{
without_leaks = *s1;
*s1 = NULL;
}
else
{
without_leaks = ft_strjoin(*s1, *s2);
ft_strdel(s1);
ft_strdel(s2);
}
return (without_leaks);
}