mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-27 04:28:52 -05:00
Assume that malloc works.
This commit is contained in:
parent
94853a3a05
commit
1fe21b22a3
|
@ -244,21 +244,10 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||||
CGGetActiveDisplayList(0, NULL, &monitorCount);
|
CGGetActiveDisplayList(0, NULL, &monitorCount);
|
||||||
|
|
||||||
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
||||||
if (!displays)
|
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGGetActiveDisplayList(monitorCount, displays, &monitorCount);
|
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++)
|
for (i = 0; i < monitorCount; i++)
|
||||||
{
|
{
|
||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
|
|
|
@ -158,12 +158,6 @@ void _glfwInputMonitorChange(void)
|
||||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
||||||
if (!monitor)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor->name = strdup(name);
|
monitor->name = strdup(name);
|
||||||
monitor->widthMM = widthMM;
|
monitor->widthMM = widthMM;
|
||||||
monitor->heightMM = heightMM;
|
monitor->heightMM = heightMM;
|
||||||
|
|
|
@ -193,12 +193,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->next = _glfw.windowListHead;
|
window->next = _glfw.windowListHead;
|
||||||
_glfw.windowListHead = window;
|
_glfw.windowListHead = window;
|
||||||
|
|
||||||
|
|
|
@ -157,13 +157,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
|
||||||
primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root);
|
primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root);
|
||||||
|
|
||||||
monitors = (_GLFWmonitor**) calloc(sr->noutput, sizeof(_GLFWmonitor*));
|
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++)
|
for (i = 0; i < sr->ncrtc; i++)
|
||||||
{
|
{
|
||||||
|
@ -220,12 +213,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
monitors = (_GLFWmonitor**) calloc(1, sizeof(_GLFWmonitor*));
|
monitors = (_GLFWmonitor**) calloc(1, sizeof(_GLFWmonitor*));
|
||||||
if (!monitors)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
monitors[0] = _glfwCreateMonitor("Display",
|
monitors[0] = _glfwCreateMonitor("Display",
|
||||||
DisplayWidthMM(_glfw.x11.display,
|
DisplayWidthMM(_glfw.x11.display,
|
||||||
_glfw.x11.screen),
|
_glfw.x11.screen),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user