summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-05-18 18:46:12 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-05-18 18:46:12 +0000
commitf5e2f4431c455984f21190cd1957a59245c079c9 (patch)
tree8e71b56f94e98208a2c40d9f1aa5df9b3af278c4
parentfbf6e11f77801365a29bf496ff982c8446d153a4 (diff)
- m_who.c: replaced several DLINK_FOREACH_SAFE with a simple DLINK_FOREACH
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2090 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r--modules/m_who.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/modules/m_who.c b/modules/m_who.c
index 724c302..9027310 100644
--- a/modules/m_who.c
+++ b/modules/m_who.c
@@ -139,10 +139,7 @@ who_global(struct Client *source_p, char *mask, int server_oper)
{
struct Channel *chptr;
struct Client *target_p;
- dlink_node *lp;
- dlink_node *lp_next;
- dlink_node *gcptr;
- dlink_node *gcptr_next;
+ dlink_node *lp = NULL, *gcptr = NULL;
int maxmatches = 500;
static time_t last_used = 0;
@@ -159,14 +156,14 @@ who_global(struct Client *source_p, char *mask, int server_oper)
}
/* first, list all matching invisible clients on common channels */
- DLINK_FOREACH_SAFE(lp, lp_next, source_p->channel.head)
+ DLINK_FOREACH(lp, source_p->channel.head)
{
chptr = ((struct Membership *)lp->data)->chptr;
who_common_channel(source_p, chptr, mask, server_oper, &maxmatches);
}
/* second, list all matching visible clients */
- DLINK_FOREACH_SAFE(gcptr, gcptr_next, global_client_list.head)
+ DLINK_FOREACH(gcptr, global_client_list.head)
{
target_p = gcptr->data;
@@ -217,9 +214,9 @@ static void
do_who_on_channel(struct Client *source_p, struct Channel *chptr,
const char *chname, int member, int server_oper)
{
- dlink_node *ptr = NULL, *ptr_next = NULL;
+ dlink_node *ptr = NULL;
- DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head)
+ DLINK_FOREACH(ptr, chptr->members.head)
{
struct Membership *ms = ptr->data;
struct Client *target_p = ms->client_p;
@@ -263,21 +260,6 @@ m_who(struct Client *client_p, struct Client *source_p,
/* mask isn't NULL at this point. repeat after me... -db */
collapse(mask);
- /* '/who *' */
- if (!strcmp(mask, "*"))
- {
- if ((lp = source_p->channel.head) != NULL)
- {
- struct Channel *mychannel = ((struct Membership *)lp->data)->chptr;
- do_who_on_channel(source_p, mychannel, mychannel->chname, 1,
- server_oper);
- }
-
- sendto_one(source_p, form_str(RPL_ENDOFWHO),
- me.name, source_p->name, "*");
- return;
- }
-
/* '/who #some_channel' */
if (IsChanPrefix(*mask))
{
@@ -317,6 +299,21 @@ m_who(struct Client *client_p, struct Client *source_p,
return;
}
+ /* '/who *' */
+ if (!strcmp(mask, "*"))
+ {
+ if ((lp = source_p->channel.head) != NULL)
+ {
+ struct Channel *mychannel = ((struct Membership *)lp->data)->chptr;
+ do_who_on_channel(source_p, mychannel, mychannel->chname, 1,
+ server_oper);
+ }
+
+ sendto_one(source_p, form_str(RPL_ENDOFWHO),
+ me.name, source_p->name, "*");
+ return;
+ }
+
/* '/who 0' */
if (!strcmp(mask, "0"))
who_global(source_p, NULL, server_oper);