From 45d528baed172c969ae2e91995abcb05cc5495e2 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 7 Oct 2014 16:20:49 +0200 Subject: [PATCH] Cleanup. --- src/context.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/context.c b/src/context.c index fe94af76..8f01846a 100644 --- a/src/context.c +++ b/src/context.c @@ -35,9 +35,9 @@ // Parses the client API version string and extracts the version number // -static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) +static GLboolean parseVersionString(int* api, int* major, int* minor, int* rev) { - int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0; + int i; const char* version; const char* prefixes[] = { @@ -47,6 +47,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) NULL }; + *api = GLFW_OPENGL_API; + version = (const char*) glGetString(GL_VERSION); if (!version) { @@ -62,23 +64,18 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) if (strncmp(version, prefixes[i], length) == 0) { version += length; - _api = GLFW_OPENGL_ES_API; + *api = GLFW_OPENGL_ES_API; break; } } - if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev)) + if (!sscanf(version, "%d.%d.%d", major, minor, rev)) { _glfwInputError(GLFW_PLATFORM_ERROR, "No version found in context version string"); return GL_FALSE; } - *api = _api; - *major = _major; - *minor = _minor; - *rev = _rev; - return GL_TRUE; } @@ -379,10 +376,10 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); - if (!parseGLVersion(&window->context.api, - &window->context.major, - &window->context.minor, - &window->context.revision)) + if (!parseVersionString(&window->context.api, + &window->context.major, + &window->context.minor, + &window->context.revision)) { return GL_FALSE; }