From: Nanley Chery <nanley.g.ch...@intel.com>

This variable existed to provide an unsigned error value for
name_to_offset(). Since o(extension_sentinel) is also a valid unsigned
error value, save space and replace this mysterious variable with
a less mysterious one (extension_sentinel).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/mesa/main/extensions.c | 9 +++++----
 src/mesa/main/mtypes.h     | 3 +--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 7373928..d050b0f 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -79,16 +79,17 @@ static size_t
 name_to_offset(const char* name)
 {
    unsigned i;
+   const size_t error_value = o(extension_sentinel);
 
    if (name == 0)
-      return 0;
+      return error_value;
 
    for (i = 0; i < ARRAY_SIZE(extension_table); ++i) {
       if (strcmp(name, extension_table[i].name) == 0)
         return extension_table[i].offset;
    }
 
-   return 0;
+   return error_value;
 }
 
 /**
@@ -209,7 +210,7 @@ set_extension(struct gl_extensions *ext, const char *name, 
GLboolean state)
    size_t offset;
 
    offset = name_to_offset(name);
-   if (offset != 0 && (offset != o(dummy_true) || state != GL_FALSE)) {
+   if (offset != o(extension_sentinel) && (offset != o(dummy_true) || state != 
GL_FALSE)) {
       ((GLboolean *) ext)[offset] = state;
    }
 
@@ -321,7 +322,7 @@ _mesa_one_time_init_extension_overrides(void)
       }
 
       offset = set_extension(&_mesa_extension_override_enables, ext, enable);
-      if (offset != 0 && (offset != o(dummy_true) || enable != GL_FALSE)) {
+      if (offset != o(extension_sentinel) && (offset != o(dummy_true) || 
enable != GL_FALSE)) {
          ((GLboolean *) &_mesa_extension_override_disables)[offset] = !enable;
          recognized = true;
       } else {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a89d6d1..ef90453 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3652,9 +3652,8 @@ struct gl_constants
  */
 struct gl_extensions
 {
-   GLboolean dummy;  /* don't remove this! */
    GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
-   GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
+   GLboolean dummy_false; /* Set false by zeroed initialization. */
    GLboolean ANGLE_texture_compression_dxt;
    GLboolean ARB_ES2_compatibility;
    GLboolean ARB_ES3_compatibility;
-- 
2.6.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to