[Mesa-dev] [PATCH v2 16/18] mesa/extensions: Remove extra memsets on gl_extensions

Nanley Chery nanleychery at gmail.com
Fri Oct 30 14:19:33 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

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().

v2. Drop the hunk that zero-initializes the global structs (Marek)

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/mesa/main/extensions.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 97f23bf..0224212 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -286,9 +286,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;
    }
@@ -368,20 +365,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.2



More information about the mesa-dev mailing list