glapi: just use _gloffset_COUNT_ everywhere, which is always the function count

MAPI_TABLE_NUM_STATIC was just duplicated _gloffset_COUNT.
mesa/main no longer needs to specify the table size.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
This commit is contained in:
Marek Olšák
2025-01-25 16:33:40 -05:00
committed by Marge Bot
parent 057c7f0dd2
commit 2937d8a961
11 changed files with 24 additions and 52 deletions
+5 -8
View File
@@ -29,7 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include "glapi/glapi.h"
#include "table.h" /* for MAPI_TABLE_NUM_SLOTS */
#include "table.h"
#include "stub.h"
/*
@@ -46,7 +46,7 @@
unsigned int
_mesa_glapi_get_dispatch_table_size(void)
{
return MAPI_TABLE_NUM_SLOTS;
return _gloffset_COUNT;
}
static const struct mapi_stub *
@@ -94,16 +94,13 @@ _glapi_get_proc_name(unsigned int offset)
/** Return pointer to new dispatch table filled with no-op functions */
struct _glapi_table *
_glapi_new_nop_table(unsigned num_entries)
_glapi_new_nop_table(void)
{
struct _glapi_table *table;
if (num_entries > MAPI_TABLE_NUM_SLOTS)
num_entries = MAPI_TABLE_NUM_SLOTS;
table = malloc(num_entries * sizeof(mapi_func));
table = malloc(_gloffset_COUNT * sizeof(mapi_func));
if (table) {
memcpy(table, table_noop_array, num_entries * sizeof(mapi_func));
memcpy(table, table_noop_array, _gloffset_COUNT * sizeof(mapi_func));
}
return table;
}
-4
View File
@@ -29,12 +29,8 @@
#define _TABLE_H_
#include "entry.h"
#define MAPI_TMP_TABLE
#include "mapi_tmp.h"
#define MAPI_TABLE_NUM_SLOTS MAPI_TABLE_NUM_STATIC
struct _glapi_table;
extern const mapi_func table_noop_array[];