summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi
diff options
context:
space:
mode:
authorGeorge Sapountzis <[email protected]>2010-03-06 21:57:47 +0200
committerGeorge Sapountzis <[email protected]>2010-03-10 18:44:44 +0200
commit58985c36be85c668d059165d8282f8c8e4c7a380 (patch)
treee3c8295a2fc3920a240cc3b84dd6b6883410eaba /src/mesa/glapi
parent8c34437deda2ff8659fecdf3ea687820c9e57261 (diff)
glapi: functions for extensions table similar to static table
Diffstat (limited to 'src/mesa/glapi')
-rw-r--r--src/mesa/glapi/glapi_getproc.c69
1 files changed, 50 insertions, 19 deletions
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
index 46b466920b6..0d9358ce415 100644
--- a/src/mesa/glapi/glapi_getproc.c
+++ b/src/mesa/glapi/glapi_getproc.c
@@ -199,6 +199,45 @@ static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
static GLuint NumExtEntryPoints = 0;
+static GLint
+get_extension_proc_offset(const char *funcName)
+{
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+ return ExtEntryTable[i].dispatch_offset;
+ }
+ }
+ return -1;
+}
+
+
+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;
+ }
+ }
+ return NULL;
+}
+
+
+static const char *
+get_extension_proc_name(GLuint offset)
+{
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (ExtEntryTable[i].dispatch_offset == offset) {
+ return ExtEntryTable[i].name;
+ }
+ }
+ return NULL;
+}
+
+
/**
* strdup() is actually not a standard ANSI C or POSIX routine.
* Irix will not define it if ANSI mode is in effect.
@@ -399,13 +438,13 @@ _glapi_add_dispatch( const char * const * function_names,
PUBLIC GLint
_glapi_get_proc_offset(const char *funcName)
{
+ GLint offset;
+
/* search extension functions first */
- GLuint i;
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
- return ExtEntryTable[i].dispatch_offset;
- }
- }
+ offset = get_extension_proc_offset(funcName);
+ if (offset >= 0)
+ return offset;
+
/* search static functions */
return get_static_proc_offset(funcName);
}
@@ -420,8 +459,8 @@ _glapi_get_proc_offset(const char *funcName)
PUBLIC _glapi_proc
_glapi_get_proc_address(const char *funcName)
{
+ _glapi_proc func;
struct _glapi_function * entry;
- GLuint i;
#ifdef MANGLE
/* skip the prefix on the name */
@@ -433,11 +472,9 @@ _glapi_get_proc_address(const char *funcName)
#endif
/* search extension functions first */
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
- return ExtEntryTable[i].dispatch_stub;
- }
- }
+ func = get_extension_proc_address(funcName);
+ if (func)
+ return func;
#if !defined( XFree86Server )
/* search static functions */
@@ -461,7 +498,6 @@ _glapi_get_proc_address(const char *funcName)
const char *
_glapi_get_proc_name(GLuint offset)
{
- GLuint i;
const char * n;
/* search built-in functions */
@@ -471,12 +507,7 @@ _glapi_get_proc_name(GLuint offset)
}
/* search added extension functions */
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (ExtEntryTable[i].dispatch_offset == offset) {
- return ExtEntryTable[i].name;
- }
- }
- return NULL;
+ return get_extension_proc_name(offset);
}