panthema / 2006 / SDIOS06 / sdios06 / lib / libc / string.cc (Download File)

// disable inlining in header files, thus this file contains extern symbols
// like memset
#define LIBC_INLINE

#include <config.h>

#include <string.h>
#include <stdlib.h>

extern "C"
{
	char* strdup(const char* str)	
	{
		size_t len = strlen(str) + 1;
		char* result = (char*) malloc(len);
		memcpy(result, str, len);
		
		return result;
	}
}
RSS 2.0 Weblog Feed Atom 1.0 Weblog Feed Valid XHTML 1.1 Valid CSS (2.1)
Copyright 2005-2014 Timo Bingmann - Impressum