Make the glfw strdup implementation more efficient
This commit is contained in:
parent
1ca49b9380
commit
3d1e604a6c
5
glfw/init.c
vendored
5
glfw/init.c
vendored
@ -115,8 +115,9 @@ static void terminate(void)
|
|||||||
char* _glfw_strdup(const char* source)
|
char* _glfw_strdup(const char* source)
|
||||||
{
|
{
|
||||||
const size_t length = strlen(source);
|
const size_t length = strlen(source);
|
||||||
char* result = calloc(length + 1, 1);
|
char* result = malloc(length + 1);
|
||||||
strcpy(result, source);
|
memcpy(result, source, length);
|
||||||
|
result[length] = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user