Staging
v0.8.1
https://github.com/python/cpython
Revision cf744da03be452ea69316838f08afbd4ba464be1 authored by Georg Brandl on 05 March 2011, 13:57:44 UTC, committed by Georg Brandl on 05 March 2011, 13:57:44 UTC
1 parent b847079
Raw File
Tip revision: cf744da03be452ea69316838f08afbd4ba464be1 authored by Georg Brandl on 05 March 2011, 13:57:44 UTC
Close legacy-trunk branch.
Tip revision: cf744da
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

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