view Python/strdup.c @ 35467:dba1e2dfd8de 2.4

Patch #1168594: set sizes of non-regular files to zero. Fixes #1167128.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 27 Aug 2005 10:08:21 +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;
}