https://github.com/python/cpython
Raw File
Tip revision: 8d999cbf4adea053be6dbb612b9844635c4dfb8e authored by Ned Deily on 28 December 2021, 07:08:54 UTC
Update REAME and Docs sidebar for EOL
Tip revision: 8d999cb
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(const char *str)
{
	if (str != NULL) {
		char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}
back to top