view Python/strdup.c @ 87081:dc5ae99bc605

Issue #19437: Fix GetKeepedObjects() of ctypes, handle PyCData_GetContainer() failure
author Victor Stinner <victor.stinner@gmail.com>
date Wed, 13 Nov 2013 13:24:50 +0100
parents e7f6cef7a4cc
children
line wrap: on
line source

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