-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strdup.c
More file actions
25 lines (22 loc) · 1.07 KB
/
ft_strdup.c
File metadata and controls
25 lines (22 loc) · 1.07 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tparand <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/10 16:45:07 by tparand #+# #+# */
/* Updated: 2017/11/11 18:08:04 by tparand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s)
{
size_t s_len;
char *new_s;
s_len = ft_strlen(s);
new_s = ft_strnew(s_len);
if (!new_s)
return (NULL);
return (ft_memcpy(new_s, s, s_len));
}