-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strjoinfree.c
More file actions
30 lines (27 loc) · 1.17 KB
/
ft_strjoinfree.c
File metadata and controls
30 lines (27 loc) · 1.17 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoinfree.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mtacnet <mtacnet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/09/18 11:16:53 by mtacnet #+# #+# */
/* Updated: 2017/09/18 11:18:55 by mtacnet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoinfree(char *s1, char *s2, int mode)
{
char *tmp;
tmp = ft_strjoin(s1, s2);
if (mode == 1 && s1)
ft_strdel(&s1);
else if (mode == 2 && s2)
ft_strdel(&s2);
else if (mode != 1 && mode != 2 && s1 && s2)
{
ft_strdel(&s1);
ft_strdel(&s2);
}
return (tmp);
}