[Mesa-dev] [RFC 18/21] mesa/extensions: Remove extra memsets on gl_extensions
Nanley Chery
nanleychery at gmail.com
Mon Oct 19 15:44:56 PDT 2015
From: Nanley Chery <nanley.g.chery at intel.com>
Aside from those modified in this commit, all gl_extensions structs are
zero-initialized by default. There is therefore no need to memset the
structs to 0. Also, remove the open-coded memset in
_mesa_init_extensions().
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/mesa/main/extensions.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 365e7ed..6cd2b27 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -37,8 +37,8 @@
#include "macros.h"
#include "mtypes.h"
-struct gl_extensions _mesa_extension_override_enables;
-struct gl_extensions _mesa_extension_override_disables;
+struct gl_extensions _mesa_extension_override_enables = {0};
+struct gl_extensions _mesa_extension_override_disables = {0};
static char *extra_extensions = NULL;
static char *cant_disable_extensions = NULL;
@@ -284,9 +284,6 @@ _mesa_one_time_init_extension_overrides(void)
atexit(free_unknown_extensions_strings);
- memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions));
- memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions));
-
if (env_const == NULL) {
return;
}
@@ -366,20 +363,13 @@ _mesa_one_time_init_extension_overrides(void)
* \brief Initialize extension tables and enable default extensions.
*
* This should be called during context initialization.
+ * This function expects a zeroed gl_extensions struct.
* Note: Sets gl_extensions.dummy_true to true.
*/
void
_mesa_init_extensions(struct gl_extensions *extensions)
{
- GLboolean *base = (GLboolean *) extensions;
- GLboolean *sentinel = base + o(extension_sentinel);
- GLboolean *i;
-
- /* First, turn all extensions off. */
- for (i = base; i != sentinel; ++i)
- *i = GL_FALSE;
-
- /* Then, selectively turn default extensions on. */
+ /* Selectively turn default extensions on. */
extensions->dummy_true = GL_TRUE;
extensions->EXT_texture3D = GL_TRUE;
}
--
2.6.1
More information about the mesa-dev
mailing list