From c80c059b7fcd6299d9a1285fdb31d4d9c4827e97 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Sun, 5 Apr 2020 16:33:10 +0700 Subject: [PATCH] [+] Added function remove plugin from list by the name of the plugin. --- include/dap_chain_plugins_list.h | 1 + src/dap_chain_plugins_list.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/dap_chain_plugins_list.h b/include/dap_chain_plugins_list.h index c0ae76c..7eec969 100644 --- a/include/dap_chain_plugins_list.h +++ b/include/dap_chain_plugins_list.h @@ -31,6 +31,7 @@ dap_chain_plugin_list_module_t* dap_chain_plugins_list_get(); bool dap_chain_plugins_list_check_load_plugins(dap_chain_plugins_list_char_t *list); void dap_chain_plugins_list_add(PyObject *module, const char *name); +void dap_chain_plugins_list_name_del(const char *name); #ifdef __cplusplus extern "C" { diff --git a/src/dap_chain_plugins_list.c b/src/dap_chain_plugins_list.c index 69ef520..cac4d70 100644 --- a/src/dap_chain_plugins_list.c +++ b/src/dap_chain_plugins_list.c @@ -38,3 +38,20 @@ bool dap_chain_plugins_list_check_load_plugins(dap_chain_plugins_list_char_t *li return true; } +void dap_chain_plugins_list_name_del(const char *name){ + dap_chain_plugin_list_module_t *plugin; + dap_chain_plugin_list_module_t *tmp; + bool plugin_searcging = false; + LL_FOREACH_SAFE(m_dap_chain_plugins_module_list, plugin, tmp){ + if (strcmp(plugin->name, name) == 0){ + DAP_FREE(plugin->name); + Py_XDECREF(plugin->obj_module); + LL_DELETE(m_dap_chain_plugins_module_list, plugin); + plugin_searcging = true; + } + } + if (!plugin_searcging){ + log_it(L_WARNING, "Can't searching plugins %s for delete", name); + } +} + -- GitLab