diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2023-08-30 23:18:38 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2023-08-30 23:44:50 +0100 |
commit | 464c9398ae49d8faae46f81fb7040155408858f7 (patch) | |
tree | 3c8f035e752124a7f9f32179fa01d5c56c9d2439 /src/sst.c | |
parent | 8a1c4de9b33128c10378f1938d8a60c071f01ad0 (diff) |
Perform very minor load/unload optimisations
Because why not.
Diffstat (limited to 'src/sst.c')
-rw-r--r-- | src/sst.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -250,6 +250,7 @@ static const char *updatenotes = "\ #include <featureinit.gen.h> // generated by build/codegen.c static void do_featureinit(void) { + engineapi_lateinit(); // load libs that might not be there early (...at least on Linux???) clientlib = os_dlhandle(OS_LIT("client") OS_LIT(OS_DLSUFFIX)); if (!clientlib) { @@ -410,22 +411,19 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { } static void do_unload(void) { -#ifdef _WIN32 // this is only relevant in builds that predate linux support - if (pluginhandler) { // if not, oh well too bad :^) + if (sst_userunloaded) { // note: pluginhandler must also be set here cmd_plugin_load->cb = orig_plugin_load_cb; cmd_plugin_unload->cb = orig_plugin_unload_cb; - if (sst_userunloaded) { - struct CPlugin **plugins = pluginhandler->plugins.m.mem; - // see comment in CPlugin above. setting this to the real handle - // right before the engine tries to unload us allows it to actually - // do so. in newer branches this is redundant but doesn't do any - // harm so it's just unconditional. NOTE: old engines ALSO just leak - // the handle and never call Unload() if Load() fails; can't really - // do anything about that. - plugins[ownidx]->module = ownhandle(); - } - } +#ifdef _WIN32 // this bit is only relevant in builds that predate linux support + struct CPlugin **plugins = pluginhandler->plugins.m.mem; + // see comment in CPlugin above. setting this to the real handle right + // before the engine tries to unload us allows it to actually do so. in + // newer branches this is redundant but doesn't do any harm so it's just + // unconditional. NOTE: old engines ALSO just leak the handle and never + // call Unload() if Load() fails; can't really do anything about that. + plugins[ownidx]->module = ownhandle(); #endif + } endfeatures(); con_disconnect(); } |