Staging
v0.5.1
https://github.com/python/cpython
Revision d8f5802a826374449773369651b0e6754b43f0fe authored by Fred Drake on 02 November 2004, 19:18:20 UTC, committed by Fred Drake on 02 November 2004, 19:18:20 UTC
1 parent e193806
Raw File
Tip revision: d8f5802a826374449773369651b0e6754b43f0fe authored by Fred Drake on 02 November 2004, 19:18:20 UTC
clarify discussion of iteration in the section on the "for" statement
Tip revision: d8f5802
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