]> jfr.im git - irc/freenode/solanum.git/commitdiff
Clean up duplication in ChannelModeFunc prototypes (#52)
authorEric Mertens <redacted>
Sun, 8 Nov 2020 00:45:12 +0000 (16:45 -0800)
committerGitHub <redacted>
Sun, 8 Nov 2020 00:45:12 +0000 (16:45 -0800)
extensions/chm_operonly_compat.c
extensions/chm_quietunreg_compat.c
extensions/chm_sslonly_compat.c
include/channel.h
include/chmode.h
ircd/chmode.c

index 3d88a203d8ac2e778b92de48d5aea9091e8328d5..719e66ef456124459310fb448e444e1906adc87b 100644 (file)
@@ -14,8 +14,7 @@ static const char chm_operonly_compat[] =
 
 static int _modinit(void);
 static void _moddeinit(void);
-static void chm_operonly(struct Client *source_p, struct Channel *chptr,
-       int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
+static ChannelModeFunc chm_operonly;
 
 DECLARE_MODULE_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat);
 
index 1e176c0929a0c3af966ffff0766a5d9cb924aac4..fd08e570928ffcddaee010330f566d4b21098a68 100644 (file)
@@ -15,8 +15,7 @@ static const char chm_quietunreg_compat_desc[] =
 
 static int _modinit(void);
 static void _moddeinit(void);
-static void chm_quietunreg(struct Client *source_p, struct Channel *chptr,
-       int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
+static ChannelModeFunc chm_quietunreg;
 
 DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc);
 
index 3dca2834e9d98bdd4b57e681080d2e2c77f0c913..be9d178baedb843a5bc7ff0f66e6a35adf60d73e 100644 (file)
@@ -14,8 +14,7 @@ static const char chm_sslonly_compat_desc[] =
 
 static int _modinit(void);
 static void _moddeinit(void);
-static void chm_sslonly(struct Client *source_p, struct Channel *chptr,
-       int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
+static ChannelModeFunc chm_sslonly;
 
 DECLARE_MODULE_AV2(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_sslonly_compat_desc);
 
index bb1da83f3a504bc0ad63fa008d92ec6b2a52547e..e666279a1ac9fc0e73458b92be9145dddd2efcfd 100644 (file)
@@ -121,7 +121,7 @@ struct ChModeChange
        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);
 
 enum chm_flags
@@ -136,7 +136,7 @@ enum chm_flags
 
 struct ChannelMode
 {
-       ChannelModeFunc set_func;
+       ChannelModeFunc *set_func;
        long mode_type;
        enum chm_flags flags;
 };
index 850864a2701f60012c454d2b5082806eebac78ee..2ead3df966148fab6781bf859f79bddb0c5361e4 100644 (file)
 
 extern int chmode_flags[256];
 
-extern void chm_nosuch(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-extern void chm_orphaned(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-extern void chm_simple(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-extern void chm_ban(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-extern void chm_hidden(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-extern void chm_staff(struct Client *source_p, struct Channel *chptr,
-          int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
-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 ChannelModeFunc chm_nosuch;
+extern ChannelModeFunc chm_orphaned;
+extern ChannelModeFunc chm_simple;
+extern ChannelModeFunc chm_ban;
+extern ChannelModeFunc chm_hidden;
+extern ChannelModeFunc chm_staff;
+extern ChannelModeFunc chm_forward;
+extern ChannelModeFunc chm_throttle;
+extern ChannelModeFunc chm_key;
+extern ChannelModeFunc chm_limit;
+extern ChannelModeFunc chm_op;
+extern ChannelModeFunc chm_voice;
 
 extern unsigned int cflag_add(char c, ChannelModeFunc function);
 extern void cflag_orphan(char c);
index 585c4363defaf9284c57ea510bb0114a396d7dac..8ed74ded7cacf1e0694d22da71ecf597097a6e1b 100644 (file)
@@ -1512,7 +1512,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
 
        for (ms = modesets; ms < mend; ms++)
        {
-               ChannelModeFunc set_func = ms->cm->set_func;
+               ChannelModeFunc *set_func = ms->cm->set_func;
                if (set_func == NULL)
                        set_func = chm_nosuch;
                set_func(fakesource_p, chptr, alevel, ms->arg, &errors, ms->dir, ms->mode, ms->cm->mode_type);