PIPS
strdup.c File Reference
#include <config.h>
#include <string.h>
#include <stdlib.h>
+ Include dependency graph for strdup.c:

Go to the source code of this file.

Macros

#define __strdup   strdup
 Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. More...
 

Functions

char * __strdup (const char *s)
 Duplicate S, returning an identical malloc'd string. More...
 

Macro Definition Documentation

◆ __strdup

#define __strdup   strdup

Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc.

This file is part of the GNU C Library.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Get specification.

Definition at line 35 of file strdup.c.

Function Documentation

◆ __strdup()

char* __strdup ( const char *  s)

Duplicate S, returning an identical malloc'd string.


Definition at line 40 of file strdup.c.

41 {
42  size_t len = strlen (s) + 1;
43  void *new = malloc (len);
44 
45  if (new == NULL)
46  return NULL;
47 
48  return (char *) memcpy (new, s, len);
49 }
void * malloc(YYSIZE_T)

References malloc().

+ Here is the call graph for this function: