blob: 20187e0f0a7571f26f97df79b1da40716076c441 [file] [log] [blame]
Guido van Rossumbae29711996-08-29 17:48:26 +00001/* strdup() replacement (from stdwin, if you must know) */
2
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00003#include "pgenheaders.h"
Guido van Rossumbae29711996-08-29 17:48:26 +00004
5char *
Thomas Woutersf70ef4f2000-07-22 18:47:25 +00006strdup(const char *str)
Guido van Rossumbae29711996-08-29 17:48:26 +00007{
8 if (str != NULL) {
9 register char *copy = malloc(strlen(str) + 1);
10 if (copy != NULL)
11 return strcpy(copy, str);
12 }
13 return NULL;
14}