mirror of
https://github.com/glfw/glfw.git
synced 2026-01-15 02:25:31 +00:00
Merge ad3d0aa1b7 into 9352d8fe93
This commit is contained in:
commit
e332c7d706
27
src/init.c
27
src/init.c
@ -273,24 +273,23 @@ void* _glfw_calloc(size_t count, size_t size)
|
|||||||
|
|
||||||
void* _glfw_realloc(void* block, size_t size)
|
void* _glfw_realloc(void* block, size_t size)
|
||||||
{
|
{
|
||||||
if (block && size)
|
if (!block)
|
||||||
{
|
return _glfw_calloc(1, size);
|
||||||
void* resized = _glfw.allocator.reallocate(block, size, _glfw.allocator.user);
|
|
||||||
if (resized)
|
if (!size)
|
||||||
return resized;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (block)
|
|
||||||
{
|
{
|
||||||
_glfw_free(block);
|
_glfw_free(block);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return _glfw_calloc(1, size);
|
void* resized = _glfw.allocator.reallocate(block, size, _glfw.allocator.user);
|
||||||
|
if (!resized)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfw_free(void* block)
|
void _glfw_free(void* block)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user