https://github.com/python/cpython
Raw File
Tip revision: b87d6000f38e6158bbe1d9df5c6136f27aeace12 authored by Ned Deily on 15 August 2016, 20:21:29 UTC
Version bump for 3.6.0a4
Tip revision: b87d600
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

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