blob: 0bbfc2ebe095948b5241f7b42ec998e2b7fca56d (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/28 05:21:01 by kdx #+# #+# */
/* Updated: 2022/09/28 05:28:25 by kdx ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s)
{
char *copy;
size_t s_len;
s_len = ft_strlen(s) + 1;
copy = malloc(s_len);
if (copy == NULL)
return (NULL);
ft_memcpy(copy, s, s_len);
return (copy);
}
|