https://github.com/python/cpython
Raw File
Tip revision: 81c393b3ded977375d35297b3d47b47014b2391a authored by Georg Brandl on 10 April 2012, 17:30:22 UTC
Merge.
Tip revision: 81c393b
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