Staging
v0.5.1
https://github.com/python/cpython
Revision 8ac147d6ee42d156ecc9b3ed2f57cc9c9f86f746 authored by Jason R. Coombs on 02 September 2016, 01:55:22 UTC, committed by Jason R. Coombs on 02 September 2016, 01:55:22 UTC
1 parent 97eda15
Raw File
Tip revision: 8ac147d6ee42d156ecc9b3ed2f57cc9c9f86f746 authored by Jason R. Coombs on 02 September 2016, 01:55:22 UTC
Backed out changeset cc86e9e102e8
Tip revision: 8ac147d
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(const char *str)
{
	if (str != NULL) {
		char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}
back to top