https://github.com/python/cpython
Raw File
Tip revision: e739601a789050343f73e99c6a0962378a32e07f authored by Larry Hastings on 06 December 2015, 13:53:35 UTC
Version bump for 3.4.4rc1.
Tip revision: e739601
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