Mesa (master): mesa: Remove the size argument from _mesa_alloc_dispatch_table().

Eric Anholt anholt at kemper.freedesktop.org
Tue Jan 22 05:53:51 UTC 2013


Module: Mesa
Branch: master
Commit: ced98f17efc73c313700bbf936f7258131037ef3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ced98f17efc73c313700bbf936f7258131037ef3

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 17 16:53:31 2013 -0800

mesa: Remove the size argument from _mesa_alloc_dispatch_table().

All callers are in Mesa core and all use _gloffset_COUNT, so just rely on
the already baked-in use of _gloffset_COUNT in the function.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/api_exec.h |    2 +-
 src/mesa/main/context.c  |    9 +++------
 src/mesa/main/dlist.c    |    2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h
index 8292c12..bf3faa1 100644
--- a/src/mesa/main/api_exec.h
+++ b/src/mesa/main/api_exec.h
@@ -31,7 +31,7 @@ struct _glapi_table;
 struct gl_context;
 
 extern struct _glapi_table *
-_mesa_alloc_dispatch_table(int size);
+_mesa_alloc_dispatch_table(void);
 
 extern void
 _mesa_initialize_exec_table(struct gl_context *ctx);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e30b63a..1f06b53 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -836,7 +836,7 @@ _mesa_generic_nop(void)
  * Allocate and initialize a new dispatch table.
  */
 struct _glapi_table *
-_mesa_alloc_dispatch_table(int size)
+_mesa_alloc_dispatch_table()
 {
    /* Find the larger of Mesa's dispatch table and libGL's dispatch table.
     * In practice, this'll be the same for stand-alone Mesa.  But for DRI
@@ -846,9 +846,6 @@ _mesa_alloc_dispatch_table(int size)
    GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
    struct _glapi_table *table;
 
-   /* should never happen, but just in case */
-   numEntries = MAX2(numEntries, size);
-
    table = malloc(numEntries * sizeof(_glapi_proc));
    if (table) {
       _glapi_proc *entry = (_glapi_proc *) table;
@@ -892,7 +889,7 @@ create_beginend_table(const struct gl_context *ctx)
 {
    struct _glapi_table *table;
 
-   table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
+   table = _mesa_alloc_dispatch_table();
    if (!table)
       return NULL;
 
@@ -1013,7 +1010,7 @@ _mesa_initialize_context(struct gl_context *ctx,
       goto fail;
 
    /* setup the API dispatch tables with all nop functions */
-   ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(_gloffset_COUNT);
+   ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table();
    if (!ctx->OutsideBeginEnd)
       goto fail;
    ctx->Exec = ctx->OutsideBeginEnd;
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 1898632..7eb2cb2 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -9571,7 +9571,7 @@ _mesa_create_save_table(const struct gl_context *ctx)
 {
    struct _glapi_table *table;
 
-   table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
+   table = _mesa_alloc_dispatch_table();
    if (table == NULL)
       return NULL;
 




More information about the mesa-commit mailing list