1996-11-27 02:46:52 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* strdup.c
|
1997-09-07 07:04:48 +02:00
|
|
|
* copies a null-terminated string.
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
2004-12-31 23:04:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2005-09-27 06:53:23 +02:00
|
|
|
* $PostgreSQL: pgsql/src/port/strdup.c,v 1.8 2005/09/27 04:53:23 tgl Exp $
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2003-11-12 00:52:45 +01:00
|
|
|
|
2005-07-28 06:03:14 +02:00
|
|
|
#include "c.h"
|
|
|
|
|
1996-11-27 02:46:52 +01:00
|
|
|
#include "strdup.h"
|
|
|
|
|
2005-07-28 06:03:14 +02:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
char *
|
2005-09-27 06:53:23 +02:00
|
|
|
strdup(const char *string)
|
1996-11-27 02:46:52 +01:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
char *nstr;
|
1996-11-27 02:46:52 +01:00
|
|
|
|
2005-09-27 06:53:23 +02:00
|
|
|
nstr = (char *) malloc(strlen(string) + 1);
|
|
|
|
if (nstr)
|
|
|
|
strcpy(nstr, string);
|
1997-09-07 07:04:48 +02:00
|
|
|
return nstr;
|
1996-11-27 02:46:52 +01:00
|
|
|
}
|