Staging
v0.8.1
https://github.com/python/cpython
Revision e9f922f4977aaffb21ac68249457044178ba8e02 authored by Guido van Rossum on 08 October 2000, 19:48:46 UTC, committed by Guido van Rossum on 08 October 2000, 19:48:46 UTC
1 parent 5931667
Raw File
Tip revision: e9f922f4977aaffb21ac68249457044178ba8e02 authored by Guido van Rossum on 08 October 2000, 19:48:46 UTC
Adapt test output to changed error message.
Tip revision: e9f922f
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