diff --git a/include/supported.h b/include/supported.h index beeb89c..1ed7c0d 100644 --- a/include/supported.h +++ b/include/supported.h @@ -36,7 +36,7 @@ #define INCLUDED_supported_h extern void add_isupport(const char *, const char *(*)(const void *), const void *); -extern void change_isupport(const char *, const char *(*)(const void *), const void *); +extern const void *change_isupport(const char *, const char *(*)(const void *), const void *); extern void delete_isupport(const char *); extern void show_isupport(struct Client *); extern void init_isupport(void); diff --git a/src/supported.c b/src/supported.c index 2f52479..6c6b33c 100644 --- a/src/supported.c +++ b/src/supported.c @@ -111,11 +111,12 @@ add_isupport(const char *name, const char *(*func)(const void *), const void *pa rb_dlinkAddTail(item, &item->node, &isupportlist); } -void +const void * change_isupport(const char *name, const char *(*func)(const void *), const void *param) { rb_dlink_node *ptr; struct isupportitem *item; + void *oldvalue; RB_DLINK_FOREACH(ptr, isupportlist.head) { @@ -123,6 +124,8 @@ change_isupport(const char *name, const char *(*func)(const void *), const void if (!strcmp(item->name, name)) { + oldvalue = item->param; + item->name = name; item->func = func; item->param = param; @@ -130,6 +133,8 @@ change_isupport(const char *name, const char *(*func)(const void *), const void break; } } + + return oldvalue; } void