summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/watch.c10
-rw-r--r--src/whowas.c21
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;
}