Removed allocator.

This commit is contained in:
Camilla Berglund
2012-02-07 14:58:58 +01:00
parent 086fba40b4
commit 0c3b1b5a0e
32 changed files with 47 additions and 105 deletions
+1 -43
View File
@@ -35,30 +35,6 @@
#include <stdlib.h>
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Allocate memory using the allocator
//========================================================================
void* _glfwMalloc(size_t size)
{
return _glfwLibrary.allocator.malloc(size);
}
//========================================================================
// Free memory using the allocator
//========================================================================
void _glfwFree(void* ptr)
{
_glfwLibrary.allocator.free(ptr);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
@@ -67,31 +43,13 @@ void _glfwFree(void* ptr)
// Initialize various GLFW state
//========================================================================
GLFWAPI int glfwInit(GLFWallocator* allocator)
GLFWAPI int glfwInit(void)
{
if (_glfwInitialized)
return GL_TRUE;
memset(&_glfwLibrary, 0, sizeof(_glfwLibrary));
if (allocator)
{
// Verify that the specified model is complete
if (!allocator->malloc || !allocator->free)
{
_glfwSetError(GLFW_INVALID_VALUE, NULL);
return GL_FALSE;
}
_glfwLibrary.allocator = *allocator;
}
else
{
// Use the libc malloc and free
_glfwLibrary.allocator.malloc = malloc;
_glfwLibrary.allocator.free = free;
}
// Not all window hints have zero as their default value, so this
// needs to be here despite the memset above
_glfwSetDefaultWindowHints();