aboutsummaryrefslogtreecommitdiffstats
path: root/sched.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-18 19:16:36 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-18 19:16:36 +0000
commitc4e7299d6f6d55040a40f1873fa3de03d71ab621 (patch)
treea221d6fd779866d3a7b783647043e64cf6335c07 /sched.c
parent0f642e9987c66cd1cbfa11a3b95c07d84bd27e7d (diff)
use ast_calloc instead of malloc+memset and remove some unnecessary initializations
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13453 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'sched.c')
-rw-r--r--sched.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sched.c b/sched.c
index eafe292c5..effd6d810 100644
--- a/sched.c
+++ b/sched.c
@@ -74,18 +74,13 @@ struct sched_context {
struct sched_context *sched_context_create(void)
{
struct sched_context *tmp;
- tmp = malloc(sizeof(struct sched_context));
- if (tmp) {
- memset(tmp, 0, sizeof(struct sched_context));
- ast_mutex_init(&tmp->lock);
- tmp->eventcnt = 1;
- tmp->schedcnt = 0;
- tmp->schedq = NULL;
-#ifdef SCHED_MAX_CACHE
- tmp->schedc = NULL;
- tmp->schedccnt = 0;
-#endif
- }
+
+ if (!(tmp = ast_calloc(1, sizeof(*tmp))))
+ return NULL;
+
+ ast_mutex_init(&tmp->lock);
+ tmp->eventcnt = 1;
+
return tmp;
}