glx/glvnd: list the strcmp arguments in correct order
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 1 Sep 2016 09:36:44 +0000 (10:36 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 5 Sep 2016 10:59:07 +0000 (11:59 +0100)
Currently, due to the inverse order, strcmp will produce negative result
when the needle is towards the start of the haystack. Thus on the next
iteration(s) we'll end up further towards the end and eventually fail to
locate the entry.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/glx/glxglvnd.c

index 962eda8bb5b2e8d16274a663c3bfc1fb45151773..098304d5574909746af915e6edde4b01e7fdc8b5 100644 (file)
@@ -24,8 +24,8 @@ static unsigned FindGLXFunction(const GLubyte *name)
 
     while (first <= last) {
         int middle = (first + last) / 2;
-        int comp = strcmp((const char *) name,
-                          __glXDispatchTableStrings[middle]);
+        int comp = strcmp(__glXDispatchTableStrings[middle],
+                          (const char *) name);
 
         if (comp < 0)
             first = middle + 1;