Staging
v0.5.1
https://github.com/python/cpython
Revision 432ea4ff375f920fa4a469d34e5dad56fb33f915 authored by Benjamin Peterson on 16 August 2016, 04:40:14 UTC, committed by Benjamin Peterson on 16 August 2016, 04:40:14 UTC
1 parent 5e4aafa
Raw File
Tip revision: 432ea4ff375f920fa4a469d34e5dad56fb33f915 authored by Benjamin Peterson on 16 August 2016, 04:40:14 UTC
fail when negative values are passed to instr()
Tip revision: 432ea4f
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