1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 11:13:13 +02:00

Code cleanup: 'make format', this fixes those list_for_each* for loops.

This commit is contained in:
Bram Matthys
2026-07-05 14:16:01 +02:00
parent 27ec56ad08
commit 1f45e2a524
12 changed files with 81 additions and 70 deletions
+2 -2
View File
@@ -916,9 +916,9 @@ EVENT(ct_check)
b->check_known = b->check_excepted = b->check_unknown = 0;
list_for_each_entry(client, &client_list, client_node)
ct_check_walk_one(client);
ct_check_walk_one(client);
list_for_each_entry(client, &unknown_list, lclient_node)
ct_check_walk_one(client);
ct_check_walk_one(client);
for (tier = 0; tier < CT_NUM_TIERS; tier++)
{
+6 -4
View File
@@ -145,8 +145,9 @@ void isupport_check_for_changes_one(const char *addstr, char *buf, size_t buflen
if (*changes == 0)
{
/* First change, need to start the batch */
list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch);
list_for_each_entry(acptr, &lclient_list, lclient_node)
if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch);
}
*changes = *changes + 1;
@@ -221,8 +222,9 @@ void _isupport_check_for_changes(void)
if (changes)
{
/* End the batch (for those clients who received a batch, that is) */
list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch);
list_for_each_entry(acptr, &lclient_list, lclient_node)
if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch);
}
safe_free_message_tags(mtags);
+3 -2
View File
@@ -331,8 +331,9 @@ void _exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, con
remove_dependents(client, origin, recv_mtags, comment, splitstr);
/* Special case for remote async RPC, server.rehash in particular.. */
list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node) if (!strncmp(client->id, acptr->id, SIDLEN))
free_client(acptr);
list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node)
if (!strncmp(client->id, acptr->id, SIDLEN))
free_client(acptr);
RunHook(HOOKTYPE_SERVER_QUIT, client, recv_mtags);
} else if (IsUser(client) && !IsKilled(client))
+13 -12
View File
@@ -422,18 +422,19 @@ int stats_links(Client *client, const char *para)
link_p->leaf, link_p->servername, link_p->leaf_depth);
}
#ifdef DEBUGMODE
list_for_each_entry(acptr, &client_list, client_node) if (MyConnect(acptr) && acptr->server && !IsMe(acptr))
{
if (!acptr->server->conf)
sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)",
acptr->name, acptr);
else
sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s",
acptr->name, acptr,
acptr->server->conf,
acptr->server->conf->refcount,
acptr->server->conf->flag.temporary ? "YES" : "NO");
}
list_for_each_entry(acptr, &client_list, client_node)
if (MyConnect(acptr) && acptr->server && !IsMe(acptr))
{
if (!acptr->server->conf)
sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)",
acptr->name, acptr);
else
sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s",
acptr->name, acptr,
acptr->server->conf,
acptr->server->conf->refcount,
acptr->server->conf->flag.temporary ? "YES" : "NO");
}
#endif
return 0;
}
+34 -33
View File
@@ -3784,50 +3784,51 @@ void _tkl_check_local_remove_shun(TKL *tmp)
for (i = 0; i <= 5; i++)
{
list_for_each_entry(client, &lclient_list, lclient_node) if (MyUser(client) && IsShunned(client))
{
chost = client->local->sockhost;
cname = client->user->username;
cip = GetIP(client);
if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9'))
is_ip = 1;
else
is_ip = 0;
if (is_ip == 0
? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname))
: (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) &&
match_simple(tmp->ptr.serverban->usermask, cname))
list_for_each_entry(client, &lclient_list, lclient_node)
if (MyUser(client) && IsShunned(client))
{
/*
chost = client->local->sockhost;
cname = client->user->username;
cip = GetIP(client);
if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9'))
is_ip = 1;
else
is_ip = 0;
if (is_ip == 0
? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname))
: (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) &&
match_simple(tmp->ptr.serverban->usermask, cname))
{
/*
before blindly marking this user as un-shunned, we need to check
if the user is under any other existing shuns. (#0003906)
Unfortunately, this requires crazy amounts of indentation ;-).
This enumeration code is based off of _tkl_stats()
*/
keep_shun = 0;
for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next)
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
{
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
/* the hostmask is an IP */
&& (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip)))
keep_shun = 1;
else
/* the hostmask is not an IP */
if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname))
keep_shun = 0;
for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next)
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
{
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
/* the hostmask is an IP */
&& (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip)))
keep_shun = 1;
}
else
/* the hostmask is not an IP */
if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname))
keep_shun = 1;
}
if (!keep_shun)
{
ClearShunned(client);
if (!keep_shun)
{
ClearShunned(client);
}
}
}
}
}
}
+3 -2
View File
@@ -285,8 +285,9 @@ int count_whowas_and_user_entries(void)
cnt++;
}
list_for_each_entry(client, &client_list, client_node) if (IsUser(client))
cnt++;
list_for_each_entry(client, &client_list, client_node)
if (IsUser(client))
cnt++;
return cnt;
}
+1 -1
View File
@@ -630,7 +630,7 @@ static void who_global(Client *client, char *mask, int operspy, struct who_forma
/* Initialize the markers to zero */
list_for_each_entry(acptr, &client_list, client_node)
ClearMark(acptr);
ClearMark(acptr);
/* First, if not operspy, then list all matching clients on common channels */
if (!operspy)