Make change_isupport() return the old value!!!

This commit is contained in:
William Pitcock 2008-08-29 15:36:41 -05:00
parent 17ad49a96a
commit 508c7c41fe
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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