1/* -*- buffer-read-only: t -*- vi: set ro: */
2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3#line 1
4/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007, 2009,
5   2010 Free Software Foundation, Inc.
6
7   This file is part of the GNU C Library.
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 3, or (at your option)
12   any later version.
13
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19   You should have received a copy of the GNU General Public License along
20   with this program; if not, write to the Free Software Foundation,
21   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
22
23#ifndef _LIBC
24# include <config.h>
25#endif
26
27/* Get specification.  */
28#include <string.h>
29
30#include <stdlib.h>
31
32#undef __strdup
33#ifdef _LIBC
34# undef strdup
35#endif
36
37#ifndef weak_alias
38# define __strdup strdup
39#endif
40
41/* Duplicate S, returning an identical malloc'd string.  */
42char *
43__strdup (const char *s)
44{
45  size_t len = strlen (s) + 1;
46  void *new = malloc (len);
47
48  if (new == NULL)
49    return NULL;
50
51  return (char *) memcpy (new, s, len);
52}
53#ifdef libc_hidden_def
54libc_hidden_def (__strdup)
55#endif
56#ifdef weak_alias
57weak_alias (__strdup, strdup)
58#endif
59