Staging
v0.5.1
https://github.com/python/cpython
Revision 191f2857f5f12003d5db06d3da2ad8dda7c30bff authored by Fred Drake on 22 December 1998, 18:06:02 UTC, committed by Fred Drake on 22 December 1998, 18:06:02 UTC
the author (just happened to notice this one).
1 parent 7be0cde
Raw File
Tip revision: 191f2857f5f12003d5db06d3da2ad8dda7c30bff authored by Fred Drake on 22 December 1998, 18:06:02 UTC
Use \moduleauthor and \sectionauthor instead of a comment to credit
Tip revision: 191f285
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