blob: d21a0bc9ec2430e2fc743451270753d361f898ff [file] [log] [blame]
Guido van Rossumbae29711996-08-29 17:48:26 +00001/* strdup() replacement (from stdwin, if you must know) */
2
3#include "config.h"
Guido van Rossum927f6e61996-08-29 18:10:30 +00004#include "myproto.h"
5#include "mymalloc.h"
Guido van Rossumbae29711996-08-29 17:48:26 +00006
Guido van Rossum927f6e61996-08-29 18:10:30 +00007#include <string.h>
Guido van Rossumbae29711996-08-29 17:48:26 +00008
9char *
10strdup(str)
11 const char *str;
12{
13 if (str != NULL) {
14 register char *copy = malloc(strlen(str) + 1);
15 if (copy != NULL)
16 return strcpy(copy, str);
17 }
18 return NULL;
19}