-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_freejoin.c
More file actions
27 lines (24 loc) · 1.14 KB
/
Copy pathft_freejoin.c
File metadata and controls
27 lines (24 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_freejoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jecarol <jecarol@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/02 14:21:04 by jecarol #+# #+# */
/* Updated: 2017/04/22 03:51:25 by rlkcmptr ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_freejoin(char *dst, char *src)
{
char *tmp;
tmp = malloc(sizeof(char) * (ft_strlen(dst) + 1));
tmp[0] = '\0';
ft_strcpy(tmp, dst);
ft_strdel(&dst);
if ((dst = ft_strjoin(tmp, src)) == NULL)
return (NULL);
ft_strdel(&tmp);
return (dst);
}