mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-18 15:49:56 +00:00
use ast_calloc instead of malloc+memset and remove some unnecessary initializations
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@13453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
15
sched.c
15
sched.c
@@ -74,18 +74,13 @@ struct sched_context {
|
|||||||
struct sched_context *sched_context_create(void)
|
struct sched_context *sched_context_create(void)
|
||||||
{
|
{
|
||||||
struct sched_context *tmp;
|
struct sched_context *tmp;
|
||||||
tmp = malloc(sizeof(struct sched_context));
|
|
||||||
if (tmp) {
|
if (!(tmp = ast_calloc(1, sizeof(*tmp))))
|
||||||
memset(tmp, 0, sizeof(struct sched_context));
|
return NULL;
|
||||||
|
|
||||||
ast_mutex_init(&tmp->lock);
|
ast_mutex_init(&tmp->lock);
|
||||||
tmp->eventcnt = 1;
|
tmp->eventcnt = 1;
|
||||||
tmp->schedcnt = 0;
|
|
||||||
tmp->schedq = NULL;
|
|
||||||
#ifdef SCHED_MAX_CACHE
|
|
||||||
tmp->schedc = NULL;
|
|
||||||
tmp->schedccnt = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user