From: Gunnar Beutner Date: Tue, 30 Jul 2013 16:56:21 +0000 (+0200) Subject: Use nsmalloc/nsfree for core/schedule. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/bbed4ab791a7beab41d3f5537ac17598082a2e43 Use nsmalloc/nsfree for core/schedule. --- diff --git a/core/nsmalloc.h b/core/nsmalloc.h index aa1e8432..9410d283 100644 --- a/core/nsmalloc.h +++ b/core/nsmalloc.h @@ -68,7 +68,8 @@ beginpools() { pool(TRUSTS), pool(SPAMSCAN2), pool(ACHIEVEMENTS), - pool(CHANSTATS) + pool(CHANSTATS), + pool(SCHEDULE) } endpools() #undef pool diff --git a/core/schedule.c b/core/schedule.c index e619f05e..a8986bbe 100644 --- a/core/schedule.c +++ b/core/schedule.c @@ -27,7 +27,6 @@ int schedexes; void schedulestats(int hooknum, void *arg); void initschedule() { - initschedulealloc(); events=NULL; schedadds=scheddels=schedexes=scheddelfast=0; registerhook(HOOK_CORE_STATSREQUEST, &schedulestats); diff --git a/core/schedulealloc.c b/core/schedulealloc.c index 2929826b..686af4ff 100644 --- a/core/schedulealloc.c +++ b/core/schedulealloc.c @@ -1,37 +1,13 @@ /* schedulealloc.c */ #include "schedule.h" -#include - -#define ALLOCUNIT 100 - -schedule *freescheds; - -void initschedulealloc() { - freescheds=NULL; -} +#include "nsmalloc.h" schedule *getschedule() { - int i; - schedule *sp; - - if (freescheds==NULL) { - freescheds=(schedule *)malloc(ALLOCUNIT*sizeof(schedule)); - for (i=0;icallbackparam; - - return sp; + return nsmalloc(POOL_SCHEDULE, sizeof(schedule)); } void freeschedule(schedule *sp) { - sp->callbackparam=(void *)freescheds; - sp->callback=NULL; - freescheds=sp; + return nsfree(POOL_SCHEDULE, sp); }