Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 4e02a97bd786bde6485210bd1c0f36fdc8ea8a56 authored by cvs2svn on 12 August 1998, 02:38:11 UTC
This commit was manufactured by cvs2svn to create tag 'r152a1'.
Tip revision: 4e02a97
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