diff options
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/glxglvnd.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/glx/glxglvnd.c b/src/glx/glxglvnd.c index c7c35ca3a14..96cd1fd7e95 100644 --- a/src/glx/glxglvnd.c +++ b/src/glx/glxglvnd.c @@ -19,11 +19,20 @@ static void *__glXGLVNDGetProcAddress(const GLubyte *procName) static int FindGLXFunction(const GLubyte *name) { - int i; - - for (i = 0; i < DI_FUNCTION_COUNT; i++) { - if (strcmp((const char *) name, __glXDispatchTableStrings[i]) == 0) - return i; + unsigned first = 0; + unsigned last = DI_FUNCTION_COUNT - 1; + + while (first <= last) { + unsigned middle = (first + last) / 2; + int comp = strcmp((const char *) name, + __glXDispatchTableStrings[middle]); + + if (comp < 0) + first = middle + 1; + else if (comp > 0) + last = middle - 1; + else + return middle; } return -1; } |