From: José Fonseca Date: Wed, 1 Jul 2009 09:03:59 +0000 (+0100) Subject: wgl: Optimize wglGetProcAddress. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8c4663c11cfbb80ed23b1581cf1f3ccaef28bce;p=mesa.git wgl: Optimize wglGetProcAddress. Do linear search only if prefix matches. --- diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index 4070cbd5c00..8cacbb89266 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -65,13 +65,13 @@ stw_get_proc_address( { const struct stw_extension_entry *entry; - PROC p = (PROC) _glapi_get_proc_address( lpszProc ); - if (p) - return p; + if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l') + for (entry = stw_extension_entries; entry->name; entry++) + if (strcmp( lpszProc, entry->name ) == 0) + return entry->proc; - for (entry = stw_extension_entries; entry->name; entry++) - if (strcmp( lpszProc, entry->name ) == 0) - return entry->proc; + if (lpszProc[0] == 'g' && lpszProc[1] == 'l') + return (PROC) _glapi_get_proc_address( lpszProc ); return NULL; }