Skip to content

Commit 4230b78

Browse files
committed
don't cast, mildly better var names, less confusing empty string check
1 parent aee1347 commit 4230b78

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

ircd/s_user.c

+13-10
Original file line numberDiff line numberDiff line change
@@ -1400,11 +1400,13 @@ user_welcome(struct Client *source_p)
14001400
void
14011401
oper_up(struct Client *source_p, struct oper_conf *oper_p)
14021402
{
1403-
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask, i = 0;
1403+
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask
1404+
unsigned int i = 0;
14041405
rb_dlink_node *ptr;
1406+
struct membership *mscptr;
14051407
struct Channel *chptr;
1406-
unsigned char cmode1[256], cmode2[256];
1407-
unsigned char *cmode_ptr = cmode1;
1408+
unsigned char cmodes_hidden[256], cmodes_send[256];
1409+
unsigned char *cmode_ptr = cmodes_hidden;
14081410

14091411
hook_data_umode_changed hdata;
14101412

@@ -1484,16 +1486,17 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
14841486

14851487
RB_DLINK_FOREACH(ptr, source_p->user->channel.head)
14861488
{
1487-
chptr = ((struct membership *)ptr->data)->chptr;
1488-
cmode_ptr = cmode2;
1489+
mscptr = ptr->data;
1490+
chptr = mscptr->chptr;
1491+
cmode_ptr = cmodes_send;
14891492

1490-
for (i = 0; cmode1[i]; i++)
1491-
if (chptr->mode.mode & chmode_flags[cmode1[i]])
1492-
*cmode_ptr++ = cmode1[i];
1493+
for (i = 0; cmodes_hidden[i]; i++)
1494+
if (chptr->mode.mode & chmode_flags[cmodes_hidden[i]])
1495+
*cmode_ptr++ = cmodes_hidden[i];
14931496
*cmode_ptr = '\0';
14941497

1495-
if (*cmode2)
1496-
sendto_one(source_p, ":%s MODE %s +%s", me.name, chptr->chname, cmode2);
1498+
if (cmodes_send[0] != '\0')
1499+
sendto_one(source_p, ":%s MODE %s +%s", me.name, chptr->chname, cmodes_send);
14971500
}
14981501
}
14991502

0 commit comments

Comments
 (0)