https://github.com/python/cpython
Raw File
Tip revision: b6492dd82863aa97cc383ff18b945af6ed105e31 authored by Benjamin Peterson on 12 May 2013, 03:31:33 UTC
update topics
Tip revision: b6492dd
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