view Python/strdup.c @ 70161:1bd697cdd210 2.7

Issue #12057: Convert CJK encoding testcase BLOB into multiple text files
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 16 May 2011 17:16:18 +0200
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;
}