view Python/strdup.c @ 76370:00a07720a570

Issue #14599: Fix an import caching race condition.
author Brett Cannon <brett@python.org>
date Mon, 16 Apr 2012 20:50:33 -0400
parents f79434ee41fa
children e7f6cef7a4cc
line wrap: on
line source

/* 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;
}