Staging
v0.5.1
https://github.com/python/cpython
Revision 6024834ed9887b47cfa798f20e99d5c941b97f24 authored by Andrew M. Kuchling on 05 September 2008, 15:15:56 UTC, committed by Andrew M. Kuchling on 05 September 2008, 15:15:56 UTC
1 parent 3dffcd1
Raw File
Tip revision: 6024834ed9887b47cfa798f20e99d5c941b97f24 authored by Andrew M. Kuchling on 05 September 2008, 15:15:56 UTC
#3671: Typo fix
Tip revision: 6024834
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