From 379cc9ca4a18426da09b6d4fdb44cf122db57fc2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 4 Aug 2020 03:12:51 +0200 Subject: [PATCH] Small cleanup to get_refresh_rate function --- gfx/common/win32_common.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 3e013fe448..d43219406e 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -1837,7 +1837,6 @@ float win32_get_refresh_rate(void *data) unsigned int NumModeInfoArrayElements = 0; DISPLAYCONFIG_PATH_INFO_CUSTOM *PathInfoArray = NULL; DISPLAYCONFIG_MODE_INFO_CUSTOM *ModeInfoArray = NULL; - int result = 0; #ifdef HAVE_DYNAMIC static QUERYDISPLAYCONFIG pQueryDisplayConfig; static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes; @@ -1859,11 +1858,10 @@ float win32_get_refresh_rate(void *data) (version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 1)) return refresh_rate; - result = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, + if (pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, &NumPathArrayElements, - &NumModeInfoArrayElements); - - if (result != ERROR_SUCCESS) + &NumModeInfoArrayElements) + != ERROR_SUCCESS) return refresh_rate; PathInfoArray = (DISPLAYCONFIG_PATH_INFO_CUSTOM *) @@ -1871,14 +1869,13 @@ float win32_get_refresh_rate(void *data) ModeInfoArray = (DISPLAYCONFIG_MODE_INFO_CUSTOM *) malloc(sizeof(DISPLAYCONFIG_MODE_INFO_CUSTOM) * NumModeInfoArrayElements); - result = pQueryDisplayConfig(QDC_DATABASE_CURRENT, + if (pQueryDisplayConfig(QDC_DATABASE_CURRENT, &NumPathArrayElements, PathInfoArray, &NumModeInfoArrayElements, ModeInfoArray, - &TopologyID); - - if (result == ERROR_SUCCESS && NumPathArrayElements >= 1) + &TopologyID) == ERROR_SUCCESS + && NumPathArrayElements >= 1) refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator / PathInfoArray[0].targetInfo.refreshRate.Denominator;