From 8a72918bcd2bac52ce733c4a973209afb9a5020a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 4 Sep 2022 22:24:12 +0200 Subject: [PATCH] Move helper macros to single point of use --- src/internal.h | 7 ------- src/platform.c | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/internal.h b/src/internal.h index 5aa22f59..781c8cdc 100644 --- a/src/internal.h +++ b/src/internal.h @@ -330,13 +330,6 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c #include "platform.h" -// Constructs a version number string from the public header macros -#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r -#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r) -#define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \ - GLFW_VERSION_MINOR, \ - GLFW_VERSION_REVISION) - // Checks for whether the library has been initialized #define _GLFW_REQUIRE_INIT() \ if (!_glfw.initialized) \ diff --git a/src/platform.c b/src/platform.c index d0bbd06d..c5966ae7 100644 --- a/src/platform.c +++ b/src/platform.c @@ -29,6 +29,10 @@ #include "internal.h" +// These construct a string literal from individual numeric constants +#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r +#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r) + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// @@ -146,7 +150,9 @@ GLFWAPI int glfwPlatformSupported(int platformID) GLFWAPI const char* glfwGetVersionString(void) { - return _GLFW_VERSION_NUMBER + return _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, + GLFW_VERSION_MINOR, + GLFW_VERSION_REVISION) #if defined(_GLFW_WIN32) " Win32 WGL" #endif