view Python/strdup.c @ 12713:7efbb4e6afca legacy-trunk

macfsn should always be included, like exceptions and site.
author Jack Jansen <jack.jansen@cwi.nl>
date Wed, 17 May 2000 13:27:09 +0000
parents 8efa37a770c6
children f79434ee41fa
line wrap: on
line source

/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(str)
	const char *str;
{
	if (str != NULL) {
		register char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}