[Mesa-dev] [PATCH 4/9] mesa: delete tautological compare

nobled nobled at dreamwidth.org
Sun Apr 1 15:24:25 PDT 2012


Noticed by clang:

main/extensions.c:934:14: warning: comparison of unsigned
expression < 0 is always false [-Wtautological-compare]
   if (index < 0)
       ~~~~~ ^ ~

Also don't cast away const needlessly in this function.
---
 src/mesa/main/extensions.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index b02a49d..6354ad3 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -931,14 +931,11 @@ _mesa_get_enabled_extension(struct gl_context
*ctx, GLuint index)
    size_t n;
    const struct extension *i;

-   if (index < 0)
-      return NULL;
-
    base = (GLboolean*) &ctx->Extensions;
    n = 0;
    for (i = extension_table; i->name != 0; ++i) {
       if (n == index && base[i->offset]) {
-	 return (GLubyte*) i->name;
+	 return (const GLubyte*) i->name;
       } else if (base[i->offset]) {
 	 ++n;
       }
-- 
1.7.4.1


More information about the mesa-dev mailing list