Renamed monitor helper functions for clarity.
diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index cdf8712..a0d20ff 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m
@@ -273,8 +273,8 @@ int j; const CGSize size = CGDisplayScreenSize(displays[i]); - monitors[found] = _glfwCreateMonitor(getDisplayName(displays[i]), - size.width, size.height); + monitors[found] = _glfwAllocMonitor(getDisplayName(displays[i]), + size.width, size.height); monitors[found]->ns.displayID = displays[i]; @@ -299,7 +299,7 @@ "Cocoa: Failed to find NSScreen for CGDisplay %s", monitors[found]->name); - _glfwDestroyMonitor(monitors[found]); + _glfwFreeMonitor(monitors[found]); monitors[found] = NULL; } }
diff --git a/src/init.c b/src/init.c index d34abea..ea826a0 100644 --- a/src/init.c +++ b/src/init.c
@@ -163,7 +163,7 @@ _glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp); } - _glfwDestroyMonitors(_glfw.monitors, _glfw.monitorCount); + _glfwFreeMonitors(_glfw.monitors, _glfw.monitorCount); _glfw.monitors = NULL; _glfw.monitorCount = 0;
diff --git a/src/internal.h b/src/internal.h index 748d27b..ea95b08 100644 --- a/src/internal.h +++ b/src/internal.h
@@ -761,15 +761,15 @@ * @return The newly created object. * @ingroup utility */ -_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM); +_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM); /*! @brief Frees a monitor object and any data associated with it. * @ingroup utility */ -void _glfwDestroyMonitor(_GLFWmonitor* monitor); +void _glfwFreeMonitor(_GLFWmonitor* monitor); /*! @ingroup utility */ -void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count); +void _glfwFreeMonitors(_GLFWmonitor** monitors, int count); #endif // _internal_h_
diff --git a/src/monitor.c b/src/monitor.c index f80d5e9..ecae3dd 100644 --- a/src/monitor.c +++ b/src/monitor.c
@@ -113,7 +113,7 @@ { if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j])) { - _glfwDestroyMonitor(_glfw.monitors[i]); + _glfwFreeMonitor(_glfw.monitors[i]); _glfw.monitors[i] = monitors[j]; break; } @@ -167,7 +167,7 @@ _glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED); } - _glfwDestroyMonitors(monitors, monitorCount); + _glfwFreeMonitors(monitors, monitorCount); } @@ -175,7 +175,7 @@ ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM) +_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) { _GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor)); monitor->name = strdup(name); @@ -185,7 +185,7 @@ return monitor; } -void _glfwDestroyMonitor(_GLFWmonitor* monitor) +void _glfwFreeMonitor(_GLFWmonitor* monitor) { if (monitor == NULL) return; @@ -198,12 +198,12 @@ free(monitor); } -void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count) +void _glfwFreeMonitors(_GLFWmonitor** monitors, int count) { int i; for (i = 0; i < count; i++) - _glfwDestroyMonitor(monitors[i]); + _glfwFreeMonitor(monitors[i]); free(monitors); }
diff --git a/src/win32_monitor.c b/src/win32_monitor.c index fb62cc6..acd6d82 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c
@@ -148,7 +148,7 @@ name = _glfwCreateUTF8FromWideString(display.DeviceString); if (!name) { - _glfwDestroyMonitors(monitors, found); + _glfwFreeMonitors(monitors, found); _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to convert string to UTF-8"); @@ -156,7 +156,7 @@ return NULL; } - monitors[found] = _glfwCreateMonitor(name, + monitors[found] = _glfwAllocMonitor(name, GetDeviceCaps(dc, HORZSIZE), GetDeviceCaps(dc, VERTSIZE));
diff --git a/src/x11_monitor.c b/src/x11_monitor.c index 052b3c0..e314c7b 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c
@@ -218,8 +218,8 @@ continue; } - monitors[found] = _glfwCreateMonitor(oi->name, - oi->mm_width, oi->mm_height); + monitors[found] = _glfwAllocMonitor(oi->name, + oi->mm_width, oi->mm_height); monitors[found]->x11.output = output; monitors[found]->x11.crtc = oi->crtc; @@ -254,11 +254,11 @@ else { monitors = calloc(1, sizeof(_GLFWmonitor*)); - monitors[0] = _glfwCreateMonitor("Display", - DisplayWidthMM(_glfw.x11.display, - _glfw.x11.screen), - DisplayHeightMM(_glfw.x11.display, - _glfw.x11.screen)); + monitors[0] = _glfwAllocMonitor("Display", + DisplayWidthMM(_glfw.x11.display, + _glfw.x11.screen), + DisplayHeightMM(_glfw.x11.display, + _glfw.x11.screen)); *count = 1; }