diff options
author | George Sapountzis <[email protected]> | 2010-03-07 23:04:52 +0200 |
---|---|---|
committer | George Sapountzis <[email protected]> | 2010-03-10 18:44:44 +0200 |
commit | 5b2340c493cdf8d776e717b00acf0a8002858976 (patch) | |
tree | c9eb35879e9c6cf4873b8cb1a920c65f08850117 /src/mesa/glapi | |
parent | 58985c36be85c668d059165d8282f8c8e4c7a380 (diff) |
glapi: add function to find extension by name
Diffstat (limited to 'src/mesa/glapi')
-rw-r--r-- | src/mesa/glapi/glapi_getproc.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 0d9358ce415..4205435da51 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -199,29 +199,40 @@ static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; static GLuint NumExtEntryPoints = 0; -static GLint -get_extension_proc_offset(const char *funcName) +static struct _glapi_function * +get_extension_proc(const char *funcName) { GLuint i; for (i = 0; i < NumExtEntryPoints; i++) { if (strcmp(ExtEntryTable[i].name, funcName) == 0) { - return ExtEntryTable[i].dispatch_offset; + return & ExtEntryTable[i]; } } - return -1; + return NULL; +} + + +static GLint +get_extension_proc_offset(const char *funcName) +{ + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return -1; + } + + return f->dispatch_offset; } static _glapi_proc get_extension_proc_address(const char *funcName) { - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].name, funcName) == 0) { - return ExtEntryTable[i].dispatch_stub; - } + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return NULL; } - return NULL; + + return f->dispatch_stub; } |