diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-06-19 11:58:34 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-06-19 11:58:34 +0000 |
commit | 4066915deda6f21c5b6b8726c53cb9df9d597bb2 (patch) | |
tree | aa672625499e69aa81d95409ab198398872d1167 /src | |
parent | 9a22354250f69cd9cd64916e569e6f7c207a0429 (diff) |
- whowas.c: renamed count_whowas_memory() to whowas_count_memory()
- watch_count_memory(), whowas_count_memory(): constification, renamed
variables, removed unused variables
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2298 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r-- | src/watch.c | 10 | ||||
-rw-r--r-- | src/whowas.c | 21 |
2 files changed, 12 insertions, 19 deletions
diff --git a/src/watch.c b/src/watch.c index aeb3a30..1722fed 100644 --- a/src/watch.c +++ b/src/watch.c @@ -66,14 +66,14 @@ watch_init(void) /*! \brief Counts up memory used by watch list headers */ void -watch_count_memory(unsigned int *const count, uint64_t *const memory) +watch_count_memory(unsigned int *const count, uint64_t *const bytes) { - unsigned int idx; + unsigned int idx = 0; - for (idx = 0; idx < HASHSIZE; ++idx) - *count += dlink_list_length(&watchTable[idx]); + for (; idx < HASHSIZE; ++idx) + (*count) += dlink_list_length(&watchTable[idx]); - *memory = *count * sizeof(struct Watch); + (*bytes) = *count * sizeof(struct Watch); } /*! \brief Notifies all clients that have client_p's nick name on diff --git a/src/whowas.c b/src/whowas.c index 2df8933..550d461 100644 --- a/src/whowas.c +++ b/src/whowas.c @@ -119,24 +119,17 @@ get_history(const char *nick, time_t timelimit) } void -count_whowas_memory(unsigned int *wwu, uint64_t *wwum) +whowas_count_memory(unsigned int *const count, uint64_t *const bytes) { - const struct Whowas *tmp; - int i; - unsigned int u = 0; - uint64_t um = 0; - - /* count the number of used whowas structs in 'u' */ - /* count up the memory used of whowas structs in um */ - for (i = 0, tmp = &WHOWAS[0]; i < NICKNAMEHISTORYLENGTH; ++i, ++tmp) + const struct Whowas *tmp = &WHOWAS[0]; + unsigned int i = 0; + + for (; i < NICKNAMEHISTORYLENGTH; ++i, ++tmp) { if (tmp->hashv != -1) { - ++u; - um += sizeof(struct Whowas); + (*count)++; + (*bytes) += sizeof(struct Whowas); } } - - *wwu = u; - *wwum = um; } |