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-2014 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-2014 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 General Public License as published by the Free Software Foundation; either version 3, 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
Get specification.

Definition at line 34 of file strdup.c.

Function Documentation

◆ __strdup()

char* __strdup ( const char *  s)

Duplicate S, returning an identical malloc'd string.


Definition at line 39 of file strdup.c.

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

References malloc().

+ Here is the call graph for this function: