Jacek Caban (@jacek) commented about dlls/opengl32/make_opengl:
+print OUT " void *function;\n"; +print OUT " BOOL supported;\n"; +print OUT "};\n"; +print OUT "\n"; +print OUT "static int function_entry_cmp( const void *a, const void *b )\n"; +print OUT "{\n"; +print OUT " const struct function_entry *entry_a = a, *entry_b = b;\n"; +print OUT " return strcmp( entry_a->name, entry_b->name );\n"; +print OUT "};\n"; +print OUT "\n"; +print OUT "void *get_proc_address( const char *name, const struct opengl_client_context *ctx )\n"; +print OUT "{\n"; +print OUT " const int major = ctx->major_version, minor = ctx->minor_version;\n"; +print OUT " const struct opengl_extensions *extensions = &ctx->extensions;\n"; +print OUT " const struct function_entry *found, entry = { .name = name }, functions[] =\n"; +print OUT " {\n"; I think that the `functions[]` array really should be static. Initializing it like that on every call only to use a single entry seems ridiculous to me. That, combined with the extensive use of unnecessary `USE_GL_EXT` tricks, makes me question whether this is really the right representation of extensions.
One alternative would be to have an enum representing all known extensions. Converting from a string would then be just a `bsearch` away, and with that, things like `add_extension` would be as simple as `ctx->extensions[ext] = set`, `init_wgl_extensions` could use a proper loop, etc. The function registry could just have a list of extensions' enum values. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10019#note_128767