const char *
_glapi_get_proc_name(unsigned int offset)
{
- /* not implemented */
- return NULL;
+ const struct mapi_stub *stub = stub_find_by_slot(offset);
+ return stub ? stub_get_name(stub) : NULL;
}
unsigned long
return stub;
}
+static const struct mapi_stub *
+search_table_by_slot(const struct mapi_stub *table, size_t num_entries,
+ int slot)
+{
+ size_t i;
+ for (i = 0; i < num_entries; ++i) {
+ if (table[i].slot == slot)
+ return &table[i];
+ }
+ return NULL;
+}
+
+const struct mapi_stub *
+stub_find_by_slot(int slot)
+{
+ const struct mapi_stub *stub =
+ search_table_by_slot(public_stubs, ARRAY_SIZE(public_stubs), slot);
+ if (stub)
+ return stub;
+ return search_table_by_slot(dynamic_stubs, num_dynamic_stubs, slot);
+}
+
void
stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias)
{
struct mapi_stub *
stub_find_dynamic(const char *name, int generate);
+const struct mapi_stub *
+stub_find_by_slot(int slot);
+
void
stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias);