Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 2f6c878a1402ddd83ef913928f8355d491a03d1c authored by cvs2svn on 14 April 1998, 02:16:23 UTC
This commit was manufactured by cvs2svn to create tag 'r151'.
Tip revision: 2f6c878
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