+2006-03-24 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/ircd_signal.c (alloc_crec): Zero-fill returned
+ ChildRecord structs.
+
+ * ircd/jupe.c (make_jupe): Zero-fill newly allocated jupes.
+
+ * ircd/list.c (make_link): Zero-fill returned SLink structs.
+
+ * ircd/whowas.c (whowas_init): Delete function.
+ (whowas_alloc): Rewrite to follow the more common pattern and to
+ zero-fill returned Whowas structs.
+
2006-03-23 Kevin L. Mitchell <klmitch@mit.edu>
* ircd/s_auth.c: rewrite iauth_read(), spliting out the parsing
ajupe = (struct Jupe*) MyMalloc(sizeof(struct Jupe)); /* alloc memory */
assert(0 != ajupe);
+ memset(ajupe, 0, sizeof(*ajupe));
DupString(ajupe->ju_server, server); /* copy vital information */
DupString(ajupe->ju_reason, reason);
ajupe->ju_expire = expire;
wwList.ww_alloc--;
}
-/** Initialize a whowas record.
- * @param[in,out] ww Whowas record to initialize.
- * @return The pointer \a ww.
- */
-static struct Whowas *
-whowas_init(struct Whowas *ww)
-{
- if (ww)
- memset(ww, 0, sizeof(*ww));
- return ww;
-}
-
/** Return a fresh Whowas record.
* If the total number of records is smaller than determined by
* FEAT_NICKNAMEHISTORYLENGTH, allocate a new one. Otherwise,
static struct Whowas *
whowas_alloc(void)
{
- if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH))
- return whowas_init(whowas_clean(wwList.ww_tail));
+ struct Whowas *ww;
- wwList.ww_alloc++; /* going to allocate a new one... */
- return whowas_init((struct Whowas *) MyMalloc(sizeof(struct Whowas)));
+ if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH)) {
+ /* reclaim the oldest whowas entry */
+ ww = whowas_clean(wwList.ww_tail);
+ } else {
+ /* allocate a new one */
+ wwList.ww_alloc++;
+ ww = (struct Whowas *) MyMalloc(sizeof(struct Whowas));
+ }
+
+ assert(ww != NULL);
+ memset(ww, 0, sizeof(*ww));
+ return ww;
}
/** If necessary, trim the whowas list.