Staging
v0.8.1
https://github.com/python/cpython
Revision 1b141b9553424971639bde281feb1d4e4e586dbe authored by Julien Palard on 02 July 2018, 19:56:28 UTC, committed by larryhastings on 02 July 2018, 19:56:28 UTC
1 parent 13402fc
Raw File
Tip revision: 1b141b9553424971639bde281feb1d4e4e586dbe authored by Julien Palard on 02 July 2018, 19:56:28 UTC
Doc: Backport language switcher (bpo-33700, bpo-31045) (#8048)
Tip revision: 1b141b9
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