Clean up duplication in ChannelModeFunc prototypes (#52)

This commit is contained in:
Eric Mertens 2020-11-07 16:45:12 -08:00 committed by GitHub
parent 7393690255
commit 92c6e47b4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 33 deletions

View file

@ -14,8 +14,7 @@ static const char chm_operonly_compat[] =
static int _modinit(void); static int _modinit(void);
static void _moddeinit(void); static void _moddeinit(void);
static void chm_operonly(struct Client *source_p, struct Channel *chptr, static ChannelModeFunc chm_operonly;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat); DECLARE_MODULE_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat);

View file

@ -15,8 +15,7 @@ static const char chm_quietunreg_compat_desc[] =
static int _modinit(void); static int _modinit(void);
static void _moddeinit(void); static void _moddeinit(void);
static void chm_quietunreg(struct Client *source_p, struct Channel *chptr, static ChannelModeFunc chm_quietunreg;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc); DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc);

View file

@ -14,8 +14,7 @@ static const char chm_sslonly_compat_desc[] =
static int _modinit(void); static int _modinit(void);
static void _moddeinit(void); static void _moddeinit(void);
static void chm_sslonly(struct Client *source_p, struct Channel *chptr, static ChannelModeFunc chm_sslonly;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV2(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_sslonly_compat_desc); DECLARE_MODULE_AV2(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_sslonly_compat_desc);

View file

@ -121,7 +121,7 @@ struct ChModeChange
int mems; int mems;
}; };
typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr, typedef void ChannelModeFunc(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
enum chm_flags enum chm_flags
@ -136,7 +136,7 @@ enum chm_flags
struct ChannelMode struct ChannelMode
{ {
ChannelModeFunc set_func; ChannelModeFunc *set_func;
long mode_type; long mode_type;
enum chm_flags flags; enum chm_flags flags;
}; };

View file

@ -34,30 +34,18 @@
extern int chmode_flags[256]; extern int chmode_flags[256];
extern void chm_nosuch(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_nosuch;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_orphaned;
extern void chm_orphaned(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_simple;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_ban;
extern void chm_simple(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_hidden;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_staff;
extern void chm_ban(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_forward;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_throttle;
extern void chm_hidden(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_key;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_limit;
extern void chm_staff(struct Client *source_p, struct Channel *chptr, extern ChannelModeFunc chm_op;
int alevel, const char *arg, int *errors, int dir, char c, long mode_type); extern ChannelModeFunc chm_voice;
extern void chm_forward(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern void chm_throttle(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern void chm_key(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern void chm_limit(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern void chm_op(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern void chm_voice(struct Client *source_p, struct Channel *chptr,
int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
extern unsigned int cflag_add(char c, ChannelModeFunc function); extern unsigned int cflag_add(char c, ChannelModeFunc function);
extern void cflag_orphan(char c); extern void cflag_orphan(char c);

View file

@ -1512,7 +1512,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
for (ms = modesets; ms < mend; ms++) for (ms = modesets; ms < mend; ms++)
{ {
ChannelModeFunc set_func = ms->cm->set_func; ChannelModeFunc *set_func = ms->cm->set_func;
if (set_func == NULL) if (set_func == NULL)
set_func = chm_nosuch; set_func = chm_nosuch;
set_func(fakesource_p, chptr, alevel, ms->arg, &errors, ms->dir, ms->mode, ms->cm->mode_type); set_func(fakesource_p, chptr, alevel, ms->arg, &errors, ms->dir, ms->mode, ms->cm->mode_type);