]> granicus.if.org Git - postgresql/blob - src/port/strdup.c
85fa952728bb255b4156c588e7d0f63e26ba0e1a
[postgresql] / src / port / strdup.c
1 /*-------------------------------------------------------------------------
2  *
3  * strdup.c
4  *        copies a null-terminated string.
5  *
6  * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        $PostgreSQL: pgsql/src/port/strdup.c,v 1.9 2006/03/05 15:59:10 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15
16 #include "c.h"
17
18 #include "strdup.h"
19
20
21 char *
22 strdup(const char *string)
23 {
24         char       *nstr;
25
26         nstr = (char *) malloc(strlen(string) + 1);
27         if (nstr)
28                 strcpy(nstr, string);
29         return nstr;
30 }