From a01a93eaa3a244795fd571b3658c46c66cfe67ee Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 15 Apr 2017 22:50:24 +1000 Subject: [PATCH] Fix removal of DCC_PROC-type plugin addins The declaration of dcc_dllcommands in modules.c was wrong - add it to dcc.h so it's checked against the definition in dcc.c and include it from there. The DCC_dllcommands structure isn't structured like a "List2" so remove_module() doesn't work - use remove_from_list_ext(). --- include/dcc.h | 4 ++++ source/modules.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/dcc.h b/include/dcc.h index 03a611b..0c053bc 100644 --- a/include/dcc.h +++ b/include/dcc.h @@ -8,6 +8,10 @@ #ifndef __dcc_h_ #define __dcc_h_ +#include "struct.h" + +extern DCC_dllcommands *dcc_dllcommands; + /* * these are all used in the bot_link layer. the dcc_printf is used in * a few other places as well. ie dcc.c diff --git a/source/modules.c b/source/modules.c index 4bdb5ec..94dbd02 100644 --- a/source/modules.c +++ b/source/modules.c @@ -43,7 +43,6 @@ CVS_REVISION(modules_c) IrcVariableDll *dll_variable = NULL; extern void *default_output_function; -extern DCC_dllcommands dcc_dllcommands; extern void *default_status_output_function; Function_ptr global_table[NUMBER_OF_GLOBAL_FUNCTIONS] = { NULL }; @@ -1158,6 +1157,11 @@ register List2 *tmp; return NULL; } +static int cmp_dcc_dllcmd_module(List *node, char *name) +{ + const DCC_dllcommands *dllcmd = (DCC_dllcommands *)node; + return strcasecmp(dllcmd->module, name); +} int BX_remove_module_proc(unsigned int mod_type, char *modname, char *procname, char *desc) { @@ -1274,7 +1278,7 @@ int count = 0; case DCC_PROC: { DCC_dllcommands *ptr; - while ((ptr = (DCC_dllcommands *)remove_module((List2 **)&dcc_dllcommands, modname))) + while ((ptr = (DCC_dllcommands *)remove_from_list_ext((List **)&dcc_dllcommands, modname, cmp_dcc_dllcmd_module))) { new_free(&ptr->name); new_free(&ptr->module);