summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-03 00:01:19 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-03 00:01:19 +0000
commiteda1fca43e1712e7fc0bc2deb5adaa4b898eafe3 (patch)
tree283ba75381023ff014ad0fa4ffd3cb01bcb522ff /src
parenta765a1155ff362c46f38faab9d66a918490d2350 (diff)
Merge commit 'trunk' into anopeng (1.8 updates, etc)
Conflicts: src/main.c src/mysql.c version.log git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1504 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/core/os_stats.c11
-rw-r--r--src/hostserv.c30
-rw-r--r--src/nickserv.c2
3 files changed, 40 insertions, 3 deletions
diff --git a/src/core/os_stats.c b/src/core/os_stats.c
index 85bdd1c90..b00cab98f 100644
--- a/src/core/os_stats.c
+++ b/src/core/os_stats.c
@@ -364,9 +364,16 @@ int do_stats(User * u)
get_chanserv_stats(&count, &mem);
notice_lang(s_OperServ, u, OPER_STATS_CHANSERV_MEM, count,
(mem + 512) / 1024);
- get_botserv_stats(&count, &mem);
- notice_lang(s_OperServ, u, OPER_STATS_BOTSERV_MEM, count,
+ if (s_BotServ) {
+ get_botserv_stats(&count, &mem);
+ notice_lang(s_OperServ, u, OPER_STATS_BOTSERV_MEM, count,
(mem + 512) / 1024);
+ }
+ if (s_HostServ) {
+ get_hostserv_stats(&count, &mem);
+ notice_lang(s_OperServ, u, OPER_STATS_HOSTSERV_MEM, count,
+ (mem + 512) / 1024);
+ }
get_operserv_stats(&count, &mem);
notice_lang(s_OperServ, u, OPER_STATS_OPERSERV_MEM, count,
(mem + 512) / 1024);
diff --git a/src/hostserv.c b/src/hostserv.c
index 52dfbc0d9..dd98d279f 100644
--- a/src/hostserv.c
+++ b/src/hostserv.c
@@ -39,6 +39,36 @@ void moduleAddHostServCmds(void)
/*************************************************************************/
/**
+ * Return information on memory use.
+ * Assumes pointers are valid.
+ **/
+
+void get_hostserv_stats(long *nrec, long *memuse)
+{
+ long count = 0, mem = 0;
+ int i;
+ HostCore *hc;
+
+ for (hc = head; hc; hc = hc->next) {
+ count++;
+ mem += sizeof(*hc);
+ if (hc->nick)
+ mem += strlen(hc->nick) + 1;
+ if (hc->vIdent)
+ mem += strlen(hc->vIdent) + 1;
+ if (hc->vHost)
+ mem += strlen(hc->vHost) + 1;
+ if (hc->creator)
+ mem += strlen(hc->creator) + 1;
+ }
+
+ *nrec = count;
+ *memuse = mem;
+}
+
+/*************************************************************************/
+
+/**
* HostServ initialization.
* @return void
*/
diff --git a/src/nickserv.c b/src/nickserv.c
index efb803393..f4f1dfae3 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -454,7 +454,7 @@ void load_ns_dbase(void)
int ver, i, j, c;
NickAlias *na, **nalast, *naprev;
NickCore *nc, **nclast, *ncprev;
- int failed = 0, len;
+ int failed = 0;
uint16 tmp16;
uint32 tmp32;
char *s, *pass;