https://github.com/python/cpython
Raw File
Tip revision: e7abfd7cefc4e737eef3a4b8c2b26fec3c97fac0 authored by Martin v. Löwis on 24 January 2010, 14:24:46 UTC
Prepare for 2.5.5c2.
Tip revision: e7abfd7
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