i965/sched: Simplify work done by add_barrier_deps().
[mesa.git] / src / glx / glxglvnd.c
index 96cd1fd7e95102a81090ae21b70a42a915d32414..962eda8bb5b2e8d16274a663c3bfc1fb45151773 100644 (file)
@@ -17,13 +17,13 @@ static void *__glXGLVNDGetProcAddress(const GLubyte *procName)
     return glXGetProcAddressARB(procName);
 }
 
-static int FindGLXFunction(const GLubyte *name)
+static unsigned FindGLXFunction(const GLubyte *name)
 {
-    unsigned first = 0;
-    unsigned last = DI_FUNCTION_COUNT - 1;
+    int first = 0;
+    int last = DI_FUNCTION_COUNT - 1;
 
     while (first <= last) {
-        unsigned middle = (first + last) / 2;
+        int middle = (first + last) / 2;
         int comp = strcmp((const char *) name,
                           __glXDispatchTableStrings[middle]);
 
@@ -34,26 +34,23 @@ static int FindGLXFunction(const GLubyte *name)
         else
             return middle;
     }
-    return -1;
+
+    /* Just point to the dummy entry at the end of the respective table */
+    return DI_FUNCTION_COUNT;
 }
 
 static void *__glXGLVNDGetDispatchAddress(const GLubyte *procName)
 {
-    int internalIndex = FindGLXFunction(procName);
-
-    if (internalIndex >= 0) {
-        return __glXDispatchFunctions[internalIndex];
-    }
+    unsigned internalIndex = FindGLXFunction(procName);
 
-    return NULL;
+    return __glXDispatchFunctions[internalIndex];
 }
 
 static void __glXGLVNDSetDispatchIndex(const GLubyte *procName, int index)
 {
-    int internalIndex = FindGLXFunction(procName);
+    unsigned internalIndex = FindGLXFunction(procName);
 
-    if (internalIndex >= 0)
-        __glXDispatchTableIndices[internalIndex] = index;
+    __glXDispatchTableIndices[internalIndex] = index;
 }
 
 _X_EXPORT Bool __glx_Main(uint32_t version, const __GLXapiExports *exports,