From ce0982cc4a6d9733f506b56d435d2346071528e6 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 10 May 2025 00:43:00 +0100 Subject: There's no need to count the servers in os_stats. --- modules/operserv/os_stats.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'modules') diff --git a/modules/operserv/os_stats.cpp b/modules/operserv/os_stats.cpp index 015801fc1..24fe787c6 100644 --- a/modules/operserv/os_stats.cpp +++ b/modules/operserv/os_stats.cpp @@ -48,27 +48,6 @@ struct StatsType final Stats *Stats::me = nullptr; -/** - * Count servers connected to server s - * @param s The server to start counting from - * @return Amount of servers connected to server s - **/ -static int stats_count_servers(Server *s) -{ - if (!s) - return 0; - - int count = 1; - - if (!s->GetLinks().empty()) - { - for (auto *link : s->GetLinks()) - count += stats_count_servers(link); - } - - return count; -} - class CommandOSStats final : public Command { @@ -168,7 +147,7 @@ private: source.Reply(_("Uplink server: %s"), Me->GetLinks().front()->GetName().c_str()); source.Reply(_("Uplink capab: %s"), buf.c_str()); - source.Reply(_("Servers found: %d"), stats_count_servers(Me->GetLinks().front())); + source.Reply(_("Servers found: %zu"), Servers::ByName.size() - 1); return; } -- cgit