提交 e9c8d716 编写于 作者: R Robin Martinjak 提交者: Christian Semmler

made xstrdup a bit faster (theoretically)

上级 b263c40e
......@@ -61,11 +61,14 @@ static void * mem_double(void * ptr, size_t size)
static char * xstrdup(const char * s)
{
char * t ;
size_t len ;
if (!s)
return NULL ;
t = (char*)malloc(strlen(s)+1) ;
len = strlen(s) + 1 ;
t = malloc(len) ;
if (t) {
strcpy(t,s);
memcpy(t, s, len) ;
}
return t ;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册