diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-02-12 17:31:40 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-02-12 17:31:40 +0000 |
commit | 85db3d7563f7d2d4d218506771e2a2c27b74b1b1 (patch) | |
tree | bb5a6ef64366a54d79a2a8d574870aa6932e5938 | |
parent | 3ab6bbe6135da26dfe9a9ba880386fdc98f6580a (diff) |
added more error checking to _glapi_add_entrypoint()
-rw-r--r-- | src/mesa/glapi/glapi.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 65acafb246d..fc1ab6c3163 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -1,4 +1,4 @@ -/* $Id: glapi.c,v 1.33 2000/02/12 16:44:25 brianp Exp $ */ +/* $Id: glapi.c,v 1.34 2000/02/12 17:31:40 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -345,8 +345,6 @@ generate_entrypoint(GLuint functionOffset) GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset) { - GLint index; - /* Make sure we don't try to add a new entrypoint after someone * has already called _glapi_get_dispatch_table_size()! If that's * happened the caller's information will now be out of date. @@ -354,12 +352,21 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset) assert(!GetSizeCalled); /* first check if the named function is already statically present */ - index = get_static_proc_offset(funcName); + { + GLint index = get_static_proc_offset(funcName); + if (index >= 0) { + return (GLboolean) (index == offset); /* bad offset! */ + } + } - if (index >= 0) { - return (GLboolean) (index == offset); /* bad offset! */ + { + /* make sure this offset/name pair is legal */ + const char *name = _glapi_get_proc_name(offset); + if (name && strcmp(name, funcName) != 0) + return GL_FALSE; /* bad name! */ } - else { + + { /* be sure index and name match known data */ GLuint i; for (i = 0; i < NumExtEntryPoints; i++) { |