view Python/strdup.c @ 72990:8564d2b240b6

default - Fix closes Issue12529 - cgi.parse_header failure on double quotes and semicolons. Patch by Ben Darnell and Petri Lehtinen.
author Senthil Kumaran <senthil@uthcode.com>
date Thu, 20 Oct 2011 01:06:59 +0800
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;
}