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
|
|
|
*
|
2003-08-04 04:40:20 +02:00
|
|
|
* Portions Copyright (c) 1996-2003, 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
|
2003-08-04 04:40:20 +02:00
|
|
|
* $Header: /cvsroot/pgsql/src/port/strdup.c,v 1.2 2003/08/04 02:40:20 momjian Exp $
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include <string.h>
|
1996-11-28 04:32:18 +01:00
|
|
|
#include <stdlib.h>
|
1996-11-27 02:46:52 +01:00
|
|
|
#include "strdup.h"
|
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
char *
|
1997-09-07 07:04:48 +02:00
|
|
|
strdup(char const * 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
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
nstr = strcpy((char *) malloc(strlen(string) + 1), string);
|
|
|
|
return nstr;
|
1996-11-27 02:46:52 +01:00
|
|
|
}
|