~rcr/rirc

7b92a6d4c9463adcaaf0269557e61eeac7ad2b3e — Richard Robbins 11 months ago d7dda27
fix shadowed variables
3 files changed, 11 insertions(+), 10 deletions(-)

M scripts/build.sh
M src/handlers/irc_recv.c
M src/handlers/irc_send.c
M scripts/build.sh => scripts/build.sh +1 -0
@@ 9,6 9,7 @@
set -e

export CC=clang
export CFLAGS_DEBUG="-Wshadow"
export LDFLAGS="-flto -fuse-ld=lld"
export LDFLAGS_DEBUG="-fuse-ld=lld"


M src/handlers/irc_recv.c => src/handlers/irc_recv.c +3 -3
@@ 563,15 563,15 @@ irc_numeric_353(struct server *s, struct irc_message *m)

	while ((prefix = nick = irc_strsep(&nicks))) {

		struct mode m = {0};
		struct mode prfxmode = {0};

		while (!mode_prfxmode_set(&m, &(s->mode_cfg), *nick, 1))
		while (!mode_prfxmode_set(&prfxmode, &(s->mode_cfg), *nick, 1))
			nick++;

		if (*nick == 0)
			failf(s, "RPL_NAMEREPLY: invalid nick: '%s'", prefix);

		if (user_list_add(&(c->users), s->casemapping, nick, m) == USER_ERR_DUPLICATE)
		if (user_list_add(&(c->users), s->casemapping, nick, prfxmode) == USER_ERR_DUPLICATE)
			failf(s, "RPL_NAMEREPLY: duplicate nick: '%s'", nick);
	}


M src/handlers/irc_send.c => src/handlers/irc_send.c +7 -7
@@ 154,7 154,7 @@ irc_send_privmsg(struct server *s, struct channel *c, char *m)
	p2 = dup = strdup(target);

	do {
		struct channel *c;
		struct channel *c_target;

		p1 = p2;
		p2 = strchr(p2, ',');


@@ 162,18 162,18 @@ irc_send_privmsg(struct server *s, struct channel *c, char *m)
		if (p2)
			*p2++ = 0;

		if (!(c = channel_list_get(&s->clist, p1, s->casemapping))) {
		if (!(c_target = channel_list_get(&s->clist, p1, s->casemapping))) {

			if (irc_isnick(p1))
				c = channel(p1, CHANNEL_T_PRIVMSG);
				c_target = channel(p1, CHANNEL_T_PRIVMSG);
			else
				c = channel(p1, CHANNEL_T_CHANNEL);
				c_target = channel(p1, CHANNEL_T_CHANNEL);

			c->server = s;
			channel_list_add(&s->clist, c);
			c_target->server = s;
			channel_list_add(&s->clist, c_target);
		}

		newlinef(c, BUFFER_LINE_CHAT, s->nick, "%s", m);
		newlinef(c_target, BUFFER_LINE_CHAT, s->nick, "%s", m);

	} while (p2);