Some cleanups in the plugins code.

This commit is contained in:
Volker Ruppert 2021-03-07 16:01:39 +00:00
parent 0c2a9c69d6
commit a2cf072751
5 changed files with 2 additions and 10 deletions

View File

@ -73,7 +73,6 @@ PLUGIN_ENTRY_FOR_MODULE(acpi)
bx_devices.pluginACPIController = theACPIController;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theACPIController, BX_PLUGIN_ACPI);
} else if (mode == PLUGIN_FINI) {
bx_devices.pluginACPIController = &bx_devices.stubACPIController;
delete theACPIController;
} else if (mode == PLUGIN_PROBE) {
return (int)PLUGTYPE_STANDARD;

View File

@ -107,10 +107,7 @@ PLUGIN_ENTRY_FOR_MODULE(cmos)
bx_devices.pluginCmosDevice = theCmosDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theCmosDevice, BX_PLUGIN_CMOS);
} else if (mode == PLUGIN_FINI) {
if (theCmosDevice != NULL) {
delete theCmosDevice;
theCmosDevice = NULL;
}
delete theCmosDevice;
} else if (mode == PLUGIN_PROBE) {
return (int)PLUGTYPE_CORE;
}

View File

@ -159,7 +159,6 @@ PLUGIN_ENTRY_FOR_MODULE(voodoo)
if (theVoodooVga != NULL) {
delete theVoodooVga;
theVoodooVga = NULL;
bx_devices.pluginVgaDevice = &bx_devices.stubVga;
}
if (theVoodooDevice != NULL) {
delete theVoodooDevice;

View File

@ -41,7 +41,6 @@ PLUGIN_ENTRY_FOR_MODULE(ioapic)
bx_devices.pluginIOAPIC = theIOAPIC;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIOAPIC, BX_PLUGIN_IOAPIC);
} else if (mode == PLUGIN_FINI) {
bx_devices.pluginIOAPIC = &bx_devices.stubIOAPIC;
delete theIOAPIC;
} else if (mode == PLUGIN_PROBE) {
return (int)PLUGTYPE_STANDARD;

View File

@ -91,7 +91,6 @@ extern "C" {
#define PLUG_load_gui_plugin(name) bx_load_plugin(name,PLUGTYPE_GUI)
#define PLUG_load_opt_plugin(name) bx_load_plugin(name,PLUGTYPE_OPTIONAL)
#define PLUG_load_vga_plugin(name) bx_load_plugin(name,PLUGTYPE_VGA)
#define PLUG_unload_plugin(name) {bx_unload_plugin(#name,1);}
#define PLUG_unload_opt_plugin(name) bx_unload_plugin(name,1)
#define PLUG_unload_plugin_type(name,type) {bx_unload_plugin_type(name,type);}
@ -112,9 +111,8 @@ extern "C" {
#else
// When plugins are off, PLUG_load_plugin will call the plugin_entry function
// directly.
// directly (PLUGTYPE_CORE and PLUGTYPE_STANDARD only).
#define PLUG_load_plugin(name,type) {lib##name##_plugin_entry(NULL,type,1);}
#define PLUG_unload_plugin(name) {lib##name##_plugin_entry(NULL,type,0);}
// Builtin plugins macros
#define PLUG_get_plugins_count(a) bx_get_plugins_count_np(a)
#define PLUG_get_plugin_name(a,b) bx_get_plugin_name_np(a,b)