https://github.com/python/cpython
Raw File
Tip revision: 06ddddf117ec8d1955265d246cce7932fac93729 authored by Georg Brandl on 03 July 2011, 07:42:43 UTC
NEWS rewrap.
Tip revision: 06ddddf
strdup.c
/* 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;
}
back to top