From e0213a695356085fe7f490594dce92a50fd83c81 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 5 Jun 2023 15:14:02 -0700 Subject: [PATCH] mapi: Clean up mapi_stub struct. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We no longer use the address field, and the name is always a size_t offset in the string pool (never a dynamic strduped name). Acked-by: Marek Olšák Acked-by: Alyssa Rosenzweig Reviewed-by: Adam Jackson Part-of: --- src/mapi/mapi_abi.py | 2 +- src/mapi/shared-glapi/stub.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py index f1d3c0d..b677ef6 100644 --- a/src/mapi/mapi_abi.py +++ b/src/mapi/mapi_abi.py @@ -388,7 +388,7 @@ class ABIPrinter(object): """Return the initializer for struct mapi_stub array.""" stubs = [] for ent in self.entries_sorted_by_names: - stubs.append('%s{ (void *) %d, %d, NULL }' % ( + stubs.append('%s{ %d, %d }' % ( self.indent, pool_offsets[ent], ent.slot)) return ',\n'.join(stubs) diff --git a/src/mapi/shared-glapi/stub.c b/src/mapi/shared-glapi/stub.c index dc5cda6..0bf54a8 100644 --- a/src/mapi/shared-glapi/stub.c +++ b/src/mapi/shared-glapi/stub.c @@ -39,9 +39,8 @@ struct mapi_stub { - const void *name; + size_t name_offset; int slot; - mapi_func addr; }; /* define public_string_pool and public_stubs */ @@ -62,7 +61,7 @@ stub_compare(const void *key, const void *elem) const struct mapi_stub *stub = (const struct mapi_stub *) elem; const char *stub_name; - stub_name = &public_string_pool[(size_t) stub->name]; + stub_name = &public_string_pool[stub->name_offset]; return strcmp(name, stub_name); } @@ -104,7 +103,7 @@ stub_find_by_slot(int slot) const char * stub_get_name(const struct mapi_stub *stub) { - return &public_string_pool[(size_t) stub->name]; + return &public_string_pool[stub->name_offset]; } /** -- 2.7.4