Staging
v0.8.1
Revision 5dc3f23b5fb0b510926012cb3732dae63cddea60 authored by Miss Islington (bot) on 27 June 2018, 02:48:17 UTC, committed by GitHub on 27 June 2018, 02:48:17 UTC
(cherry picked from commit 4e21100fa7bf66e0b32146d3f46ae16afc73fee1)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
1 parent 1d55888
Raw File
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