From 892d3df6ebbb76bbddc982bdbe0b3a94f5a0d38a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 Feb 2017 15:56:04 +0530 Subject: [PATCH] DRYer --- kitty/gl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kitty/gl.h b/kitty/gl.h index 40c20d4f3..5f6ecfc52 100644 --- a/kitty/gl.h +++ b/kitty/gl.h @@ -141,14 +141,14 @@ _glewInit(PyObject UNUSED *self) { PyErr_Format(PyExc_RuntimeError, "GLEW init failed: %s", glewGetErrorString(err)); return NULL; } - if(!GLEW_ARB_texture_storage) { - PyErr_SetString(PyExc_RuntimeError, "OpenGL is missing the required ARB_texture_storage extension"); - return NULL; - } - if(!GLEW_ARB_texture_buffer_object_rgb32) { - PyErr_SetString(PyExc_RuntimeError, "OpenGL is missing the required ARB_texture_buffer_object_rgb32 extension"); - return NULL; +#define ARB_TEST(name) \ + if (!GLEW_ARB_##name) { \ + PyErr_Format(PyExc_RuntimeError, "The OpenGL driver on this system is missing the required extension: ARB_%s", #name); \ + return NULL; \ } + ARB_TEST(texture_storage); + ARB_TEST(texture_buffer_object_rgb32); +#undef ARB_TEST #endif Py_RETURN_NONE; }