From 1fe21b22a366fec179f19c486b825739bd5b5c9a Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 17 Apr 2013 15:14:42 +0200 Subject: [PATCH] Assume that malloc works. --- src/cocoa_monitor.m | 13 +------------ src/monitor.c | 6 ------ src/window.c | 6 ------ src/x11_monitor.c | 13 ------------- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 129e46b7..028adfac 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -244,21 +244,10 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) CGGetActiveDisplayList(0, NULL, &monitorCount); displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID)); - if (!displays) - { - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } + monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*)); CGGetActiveDisplayList(monitorCount, displays, &monitorCount); - monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*)); - if (!monitors) - { - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } - for (i = 0; i < monitorCount; i++) { const CGSize size = CGDisplayScreenSize(displays[i]); diff --git a/src/monitor.c b/src/monitor.c index a9d7af4f..effaf609 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -158,12 +158,6 @@ void _glfwInputMonitorChange(void) _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM) { _GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor)); - if (!monitor) - { - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } - monitor->name = strdup(name); monitor->widthMM = widthMM; monitor->heightMM = heightMM; diff --git a/src/window.c b/src/window.c index 5b5daf5a..fb4dc070 100644 --- a/src/window.c +++ b/src/window.c @@ -193,12 +193,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, return GL_FALSE; window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow)); - if (!window) - { - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } - window->next = _glfw.windowListHead; _glfw.windowListHead = window; diff --git a/src/x11_monitor.c b/src/x11_monitor.c index 462f066f..2578d2dc 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -157,13 +157,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found) primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root); monitors = (_GLFWmonitor**) calloc(sr->noutput, sizeof(_GLFWmonitor*)); - if (!monitors) - { - XRRFreeScreenResources(sr); - - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } for (i = 0; i < sr->ncrtc; i++) { @@ -220,12 +213,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found) else { monitors = (_GLFWmonitor**) calloc(1, sizeof(_GLFWmonitor*)); - if (!monitors) - { - _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); - return NULL; - } - monitors[0] = _glfwCreateMonitor("Display", DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen),