Make the glfw strdup implementation more efficient

This commit is contained in:
Kovid Goyal 2018-07-29 12:21:56 +05:30
parent 1ca49b9380
commit 3d1e604a6c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

5
glfw/init.c vendored
View File

@ -115,8 +115,9 @@ static void terminate(void)
char* _glfw_strdup(const char* source)
{
const size_t length = strlen(source);
char* result = calloc(length + 1, 1);
strcpy(result, source);
char* result = malloc(length + 1);
memcpy(result, source, length);
result[length] = 0;
return result;
}