Staging
v0.5.1
https://github.com/python/cpython
Revision d585c52511b4eae9b95c0f6ac071d4e07febec2a authored by Serhiy Storchaka on 27 October 2016, 18:41:04 UTC, committed by Serhiy Storchaka on 27 October 2016, 18:41:04 UTC
1 parent 5e5af96
Raw File
Tip revision: d585c52511b4eae9b95c0f6ac071d4e07febec2a authored by Serhiy Storchaka on 27 October 2016, 18:41:04 UTC
Issue #28496: Mark up constants 0, 1 and -1 that denote return values or
Tip revision: d585c52
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