Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: 0e5088fcc44b42879b728a495456f4b6d4181de0 authored by cvs2svn on 17 October 1998, 19:44:20 UTC
This commit was manufactured by cvs2svn to create tag 'r152a2'.
Tip revision: 0e5088f
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