3 /* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004 Free Software
6 This file is part of the GNU C Library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation,
20 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 /* Get specification. */
38 # define __strdup strdup
41 /* Duplicate S, returning an identical malloc'd string. */
43 __strdup (const char *s
)
45 size_t len
= strlen (s
) + 1;
46 void *new = malloc (len
);
51 return (char *) memcpy (new, s
, len
);
53 #ifdef libc_hidden_def
54 libc_hidden_def (__strdup
)
57 weak_alias (__strdup
, strdup
)