Staging
v0.5.1
https://github.com/python/cpython
Revision 275ea67e6b272234c3bccfedf0085308f8969412 authored by Guido van Rossum on 21 December 1998, 18:28:10 UTC, committed by Guido van Rossum on 21 December 1998, 18:28:10 UTC
_PyThreadState_Current, defined in pystate.c.
1 parent 18bc7c2
Raw File
Tip revision: 275ea67e6b272234c3bccfedf0085308f8969412 authored by Guido van Rossum on 21 December 1998, 18:28:10 UTC
Add macro version of PyThreadState_GET(). This uses
Tip revision: 275ea67
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