From e8c4663c11cfbb80ed23b1581cf1f3ccaef28bce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 1 Jul 2009 10:03:59 +0100 Subject: [PATCH] wgl: Optimize wglGetProcAddress. Do linear search only if prefix matches. --- .../state_trackers/wgl/shared/stw_getprocaddress.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.30.2