Skip to content

Commit

Permalink
Remove magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg committed Feb 8, 2020
1 parent efa7313 commit 3773f13
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/mod/server.mod/server.c
Expand Up @@ -83,8 +83,8 @@ static int double_server;
static int double_help;
static int double_warned;
static int lastpingtime; /* IRCnet LAGmeter support -- drummer */
static char stackablecmds[511];
static char stackable2cmds[511];
static char stackablecmds[MSGMAX];
static char stackable2cmds[MSGMAX];
static time_t last_time;
static int use_penalties;
static int use_fastdeq;
Expand Down Expand Up @@ -431,7 +431,7 @@ static int fast_deq(int which)
{
struct msgq_head *h;
struct msgq *m, *nm;
char msgstr[511], nextmsgstr[511], tosend[511], victims[511], stackable[511],
char msgstr[MSGMAX], nextmsgstr[MSGMAX], tosend[MSGMAX], victims[MSGMAX], stackable[MSGMAX],
*msg, *nextmsg, *cmd, *nextcmd, *to, *nextto, *stckbl;
int len, doit = 0, found = 0, cmd_count = 0, stack_method = 1;

Expand Down Expand Up @@ -557,7 +557,7 @@ static void check_queues(char *oldnick, char *newnick)
static void parse_q(struct msgq_head *q, char *oldnick, char *newnick)
{
struct msgq *m, *lm = NULL;
char buf[511], *msg, *nicks, *nick, *chan, newnicks[511], newmsg[511];
char buf[MSGMAX], *msg, *nicks, *nick, *chan, newnicks[MSGMAX], newmsg[MSGMAX];
int changed;

for (m = q->head; m;) {
Expand Down Expand Up @@ -613,8 +613,8 @@ static void parse_q(struct msgq_head *q, char *oldnick, char *newnick)
static void purge_kicks(struct msgq_head *q)
{
struct msgq *m, *lm = NULL;
char buf[511], *reason, *nicks, *nick, *chan, newnicks[511],
newmsg[511], chans[511], *chns, *ch;
char buf[MSGMAX], *reason, *nicks, *nick, *chan, newnicks[MSGMAX],
newmsg[MSGMAX], chans[MSGMAX], *chns, *ch;
int changed, found;
struct chanset_t *cs;

Expand Down Expand Up @@ -682,8 +682,8 @@ static int deq_kick(int which)
{
struct msgq_head *h;
struct msgq *msg, *m, *lm;
char buf[511], buf2[511], *reason2, *nicks, *chan, *chan2, *reason, *nick,
newnicks[511], newnicks2[511], newmsg[511];
char buf[MSGMAX], buf2[MSGMAX], *reason2, *nicks, *chan, *chan2, *reason, *nick,
newnicks[MSGMAX], newnicks2[MSGMAX], newmsg[MSGMAX];
int changed = 0, nr = 0;

if (!optimize_kicks)
Expand Down Expand Up @@ -822,7 +822,7 @@ static void queue_server(int which, char *msg, int len)
struct msgq_head *h = NULL, tempq;
struct msgq *q, *tq, *tqq;
int doublemsg = 0, qnext = 0;
char buf[511];
char buf[MSGMAX];

/* Don't even BOTHER if there's no server online. */
if (serv < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/mod/server.mod/server.h
Expand Up @@ -25,7 +25,7 @@

#define CAPMAX 499 /* (512 - "CAP REQ :XXX\r\n") */
#define TAGMAX 8191 /* Max size for IRCv3 message-tags */
#define MSGMAX 512 /* Max size of IRC message line */
#define MSGMAX 511 /* Max size of IRC message line */

#define check_tcl_ctcp(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,H_ctcp)
#define check_tcl_ctcr(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,H_ctcr)
Expand Down
8 changes: 4 additions & 4 deletions src/mod/server.mod/tclserv.c
Expand Up @@ -33,7 +33,7 @@ static int tcl_isbotnick STDVAR
static int tcl_putnow STDVAR
{
int len;
char buf[512], *p, *q, *r;
char buf[MSGMAX], *p, *q, *r;

BADARGS(2, 3, " text ?options?");

Expand Down Expand Up @@ -83,7 +83,7 @@ static int tcl_putnow STDVAR

static int tcl_putquick STDVAR
{
char s[511], *p;
char s[MSGMAX], *p;

BADARGS(2, 3, " text ?options?");

Expand All @@ -110,7 +110,7 @@ static int tcl_putquick STDVAR

static int tcl_putserv STDVAR
{
char s[511], *p;
char s[MSGMAX], *p;

BADARGS(2, 3, " text ?options?");

Expand All @@ -137,7 +137,7 @@ static int tcl_putserv STDVAR

static int tcl_puthelp STDVAR
{
char s[511], *p;
char s[MSGMAX], *p;

BADARGS(2, 3, " text ?options?");

Expand Down

0 comments on commit 3773f13

Please sign in to comment.