Replaced malloc and free with GLFW allocator.

This commit is contained in:
Camilla Berglund 2012-01-29 15:30:43 +01:00
parent e05f0c0f53
commit a5b8c8db18

View File

@ -152,7 +152,7 @@ static void addJoystickElement(_glfwJoystick* joystick, CFTypeRef refElement)
long number; long number;
CFTypeRef refType; CFTypeRef refType;
_glfwJoystickElement* element = (_glfwJoystickElement*) malloc(sizeof(_glfwJoystickElement)); _glfwJoystickElement* element = (_glfwJoystickElement*) _glfwMalloc(sizeof(_glfwJoystickElement));
CFArrayAppendValue(elementsArray, element); CFArrayAppendValue(elementsArray, element);
@ -238,7 +238,7 @@ static void removeJoystick(_glfwJoystick* joystick)
{ {
_glfwJoystickElement* axes = _glfwJoystickElement* axes =
(_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Axes, i); (_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Axes, i);
free(axes); _glfwFree(axes);
} }
CFArrayRemoveAllValues(joystick->Axes); CFArrayRemoveAllValues(joystick->Axes);
joystick->NumAxes = 0; joystick->NumAxes = 0;
@ -247,7 +247,7 @@ static void removeJoystick(_glfwJoystick* joystick)
{ {
_glfwJoystickElement* button = _glfwJoystickElement* button =
(_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Buttons, i); (_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Buttons, i);
free(button); _glfwFree(button);
} }
CFArrayRemoveAllValues(joystick->Buttons); CFArrayRemoveAllValues(joystick->Buttons);
joystick->NumButtons = 0; joystick->NumButtons = 0;
@ -256,7 +256,7 @@ static void removeJoystick(_glfwJoystick* joystick)
{ {
_glfwJoystickElement* hat = _glfwJoystickElement* hat =
(_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Hats, i); (_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick->Hats, i);
free(hat); _glfwFree(hat);
} }
CFArrayRemoveAllValues(joystick->Hats); CFArrayRemoveAllValues(joystick->Hats);
joystick->Hats = 0; joystick->Hats = 0;