From 71719a0aca6a5adcf075025ef0f298ced6f3fe9e Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Tue, 14 Jun 2005 04:47:00 +0000 Subject: [PATCH] Fix some memory counting buglets. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1422 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 13 +++++++++++++ ircd/s_conf.c | 4 ---- ircd/s_debug.c | 4 ++-- ircd/s_user.c | 4 ---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5c03f0..ef85125 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-05-13 Michael Poole + + * ircd/s_user.c (make_user): Unconditionally increment userCount. + (free_user): Unconditionally decrement it here. + + * ircd/s_conf.c (make_conf): Unconditionally increment + GlobalConfCount. + (free_conf): Unconditionally decrement it here. + + * ircd/s_debug.c (count_memory): Fix termination condition for + ban-walking loop. Add missing "e" to "members". + + 2005-05-10 Michael Poole * ircd/match.c (check_if_ipmask): Strings that contain '?' cannot diff --git a/ircd/s_conf.c b/ircd/s_conf.c index afcfa6c..2dea359 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -129,9 +129,7 @@ struct ConfItem* make_conf(int type) aconf = (struct ConfItem*) MyMalloc(sizeof(struct ConfItem)); assert(0 != aconf); -#ifdef DEBUGMODE ++GlobalConfCount; -#endif memset(aconf, 0, sizeof(struct ConfItem)); aconf->status = type; aconf->next = GlobalConfList; @@ -159,9 +157,7 @@ void free_conf(struct ConfItem *aconf) MyFree(aconf->name); MyFree(aconf->hub_limit); MyFree(aconf); -#ifdef DEBUGMODE --GlobalConfCount; -#endif } /** Disassociate configuration from the client. diff --git a/ircd/s_debug.c b/ircd/s_debug.c index c1e6169..6df059b 100644 --- a/ircd/s_debug.c +++ b/ircd/s_debug.c @@ -292,7 +292,7 @@ void count_memory(struct Client *cptr, const struct StatDesc *sd, chm += (strlen(chptr->chname) + sizeof(struct Channel)); for (link = chptr->invites; link; link = link->next) chi++; - for (ban = chptr->banlist; link; ban = ban->next) + for (ban = chptr->banlist; ban; ban = ban->next) { chb++; chbm += strlen(ban->who) + strlen(ban->banstr) + 2 + sizeof(*ban); @@ -335,7 +335,7 @@ void count_memory(struct Client *cptr, const struct StatDesc *sd, send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":Channels %d(%zu) Bans %d(%zu)", ch, chm, chb, chbm); send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, - ":Channel membrs %d(%zu) invite %d(%zu)", memberships, + ":Channel members %d(%zu) invite %d(%zu)", memberships, memberships * sizeof(struct Membership), chi, chi * sizeof(struct SLink)); diff --git a/ircd/s_user.c b/ircd/s_user.c index 285acb6..141c0f8 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -91,9 +91,7 @@ struct User *make_user(struct Client *cptr) /* All variables are 0 by default */ memset(cli_user(cptr), 0, sizeof(struct User)); -#ifdef DEBUGMODE ++userCount; -#endif cli_user(cptr)->refcnt = 1; } return cli_user(cptr); @@ -120,9 +118,7 @@ void free_user(struct User* user) assert(0 == user->channel); MyFree(user); -#ifdef DEBUGMODE --userCount; -#endif } } -- 2.20.1