From 0548c713e864c901f3622ac6117ef26d1ee078fa Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 21 Jan 2014 15:23:11 +0100 Subject: [PATCH] Renamed monitor helper functions for clarity. --- src/cocoa_monitor.m | 6 +++--- src/init.c | 2 +- src/internal.h | 6 +++--- src/monitor.c | 12 ++++++------ src/win32_monitor.c | 4 ++-- src/x11_monitor.c | 14 +++++++------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index cdf87127..a0d20ff6 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -273,8 +273,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) 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 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) "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 d34abea7..ea826a0e 100644 --- a/src/init.c +++ b/src/init.c @@ -163,7 +163,7 @@ GLFWAPI void glfwTerminate(void) _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 748d27b1..ea95b083 100644 --- a/src/internal.h +++ b/src/internal.h @@ -761,15 +761,15 @@ void _glfwFreeGammaArrays(GLFWgammaramp* ramp); * @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 f80d5e9d..ecae3dd2 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -113,7 +113,7 @@ void _glfwInputMonitorChange(void) { 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 @@ void _glfwInputMonitorChange(void) _glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED); } - _glfwDestroyMonitors(monitors, monitorCount); + _glfwFreeMonitors(monitors, monitorCount); } @@ -175,7 +175,7 @@ void _glfwInputMonitorChange(void) ////// 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 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM) return monitor; } -void _glfwDestroyMonitor(_GLFWmonitor* monitor) +void _glfwFreeMonitor(_GLFWmonitor* monitor) { if (monitor == NULL) return; @@ -198,12 +198,12 @@ void _glfwDestroyMonitor(_GLFWmonitor* monitor) 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 fb62cc60..acd6d820 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -148,7 +148,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) 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 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) 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 052b3c09..e314c7b6 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -218,8 +218,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) 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 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) 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; }