[asterisk-commits] trunk r13453 - /trunk/sched.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Mar 18 12:16:37 MST 2006


Author: russell
Date: Sat Mar 18 13:16:36 2006
New Revision: 13453

URL: http://svn.digium.com/view/asterisk?rev=13453&view=rev
Log:
use ast_calloc instead of malloc+memset and remove some unnecessary initializations

Modified:
    trunk/sched.c

Modified: trunk/sched.c
URL: http://svn.digium.com/view/asterisk/trunk/sched.c?rev=13453&r1=13452&r2=13453&view=diff
==============================================================================
--- trunk/sched.c (original)
+++ trunk/sched.c Sat Mar 18 13:16:36 2006
@@ -74,18 +74,13 @@
 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;
 }
 



More information about the asterisk-commits mailing list