Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 16c8eccfcf85811d1d9368aacb94b47ae8195719 authored by cvs2svn on 31 December 1997, 05:53:15 UTC
This commit was manufactured by cvs2svn to create tag 'release15'.
Tip revision: 16c8ecc
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "config.h"
#include "myproto.h"
#include "mymalloc.h"

#include <string.h>

char *
strdup(str)
	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