view Python/strdup.c @ 65997:3207d9f4d00a 2.7

Document key-functions in the glossary.
author Raymond Hettinger <python@rcn.com>
date Sat, 06 Nov 2010 00:06:14 +0000
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;
}