aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_strdup.c
blob: 3a6be3176a72c6608c9a7a8db3551206ab81f9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "libft.h"
#include <stdlib.h>

char *
ft_strdup (const char *s)
{
  size_t len;
  char *dup;

  len = ft_strlen (s);
  dup = malloc (len + 1);
  if (!dup)
    return (NULL);
  ft_memcpy (dup, s, len + 1);
  return (dup);
}