Staging
v0.5.1
https://github.com/python/cpython
Revision 018a3622e8f0662fd3e82c2e1ad90d14131b1d3e authored by Georg Brandl on 26 March 2008, 12:57:47 UTC, committed by Georg Brandl on 26 March 2008, 12:57:47 UTC
1 parent 8c78cc3
Raw File
Tip revision: 018a3622e8f0662fd3e82c2e1ad90d14131b1d3e authored by Georg Brandl on 26 March 2008, 12:57:47 UTC
Fix and simplify error handling, silencing a compiler warning.
Tip revision: 018a362
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