summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-07-27 20:03:10 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-07-27 20:03:10 -0400
commit66c0e280ee9d4940fe5a477d3e933ba4221e35db (patch)
tree8c55ebda067c05b2b0d4cda973c09e8463c24174
parent92edce8ef9da7bb1bd337c2b9ece2589d664689c (diff)
A few more random annoyances cleaned up.
-rw-r--r--include/extern.h4
-rw-r--r--modules/core/os_stats.cpp4
-rw-r--r--src/sessions.cpp18
3 files changed, 11 insertions, 15 deletions
diff --git a/include/extern.h b/include/extern.h
index 7f1bcdb6f..308a33de6 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -350,8 +350,8 @@ E void notice_help(const Anope::string &source, User *dest, int message, ...); /
E std::vector<Exception *> exceptions;
-E void get_session_stats(long *nrec, long *memuse);
-E void get_exception_stats(long *nrec, long *memuse);
+E void get_session_stats(long &count, long &mem);
+E void get_exception_stats(long &count, long &mem);
E int add_session(const Anope::string &nick, const Anope::string &host, const Anope::string &hostip);
E void del_session(const Anope::string &host);
diff --git a/modules/core/os_stats.cpp b/modules/core/os_stats.cpp
index b7f9174e4..08a27e31d 100644
--- a/modules/core/os_stats.cpp
+++ b/modules/core/os_stats.cpp
@@ -244,7 +244,7 @@ class CommandOSStats : public Command
}
get_operserv_stats(&count, &mem);
notice_lang(Config.s_OperServ, u, OPER_STATS_OPERSERV_MEM, count, (mem + 512) / 1024);
- get_session_stats(&count, &mem);
+ get_session_stats(count, mem);
notice_lang(Config.s_OperServ, u, OPER_STATS_SESSIONS_MEM, count, (mem + 512) / 1024);
return MOD_CONT;
@@ -381,7 +381,7 @@ void get_operserv_stats(long *nrec, long *memuse)
}
}
- get_exception_stats(&count2, &mem2);
+ get_exception_stats(count2, mem2);
count += count2;
mem += mem2;
diff --git a/src/sessions.cpp b/src/sessions.cpp
index 31deb02c3..f765a9460 100644
--- a/src/sessions.cpp
+++ b/src/sessions.cpp
@@ -57,9 +57,10 @@ std::vector<Exception *> exceptions;
/****************************** Statistics *******************************/
/*************************************************************************/
-void get_session_stats(long *nrec, long *memuse)
+void get_session_stats(long &count, long &mem)
{
- long mem = sizeof(Session) * SessionList.size();
+ count = SessionList.size();
+ mem = sizeof(Session) * SessionList.size();
for (session_map::const_iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it)
{
@@ -67,16 +68,13 @@ void get_session_stats(long *nrec, long *memuse)
mem += session->host.length() + 1;
}
-
- *memuse = mem;
- *nrec = SessionList.size();
}
-void get_exception_stats(long *nrec, long *memuse)
+void get_exception_stats(long &count, long &mem)
{
- long mem;
-
+ count = exceptions.size();
mem = sizeof(Exception) * exceptions.size();
+
for (std::vector<Exception *>::const_iterator it = exceptions.begin(), it_end = exceptions.end(); it != it_end; ++it)
{
Exception *e = *it;
@@ -87,8 +85,6 @@ void get_exception_stats(long *nrec, long *memuse)
if (!e->who.empty())
mem += e->who.length() + 1;
}
- *nrec = exceptions.size();
- *memuse = mem;
}
/*************************************************************************/
@@ -158,7 +154,7 @@ int add_session(const Anope::string &nick, const Anope::string &host, const Anop
}
}
- session = new Session;
+ session = new Session();
session->host = host;
session->count = 1;
session->hits = 0;