Staging
v0.5.1
Revision 8cd0b38392994c5af7d9bd430c149bdd3a0f9a6d authored by Raymond Hettinger on 07 February 2011, 04:00:24 UTC, committed by Raymond Hettinger on 07 February 2011, 04:00:24 UTC
1 parent 833ad0e
Raw File
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(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