Staging
v0.5.1
https://github.com/python/cpython
Revision 9b24649118b99987a42fcab0a9793bd5d2b0d762 authored by cvs2svn on 15 August 1997, 20:18:44 UTC, committed by cvs2svn on 15 August 1997, 20:18:44 UTC
1 parent 1fed5b3
Raw File
Tip revision: 9b24649118b99987a42fcab0a9793bd5d2b0d762 authored by cvs2svn on 15 August 1997, 20:18:44 UTC
This commit was manufactured by cvs2svn to create tag 'r15a3'.
Tip revision: 9b24649
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