[asterisk-commits] rmudgett: trunk r270298 - in /trunk/channels: chan_dahdi.c sig_ss7.c sig_ss7.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 14 15:51:13 CDT 2010


Author: rmudgett
Date: Mon Jun 14 15:51:09 2010
New Revision: 270298

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270298
Log:
Extract sig_ss7_init_linkset() to sig_ss7.

Also found a place where sig_pri_init_pri() was inlined and called it
instead.

Modified:
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_ss7.c
    trunk/channels/sig_ss7.h

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=270298&r1=270297&r2=270298
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Jun 14 15:51:09 2010
@@ -14329,11 +14329,8 @@
 
 	memset(pris, 0, sizeof(pris));
 	for (i = 0; i < NUM_SPANS; i++) {
-		ast_mutex_init(&pris[i].pri.lock);
-		pris[i].pri.master = AST_PTHREADT_NULL;
-		for (j = 0; j < SIG_PRI_NUM_DCHANS; j++)
-			pris[i].pri.fds[j] = -1;
-		}
+		sig_pri_init_pri(&pris[i].pri);
+	}
 	pri_set_error(dahdi_pri_error);
 	pri_set_message(dahdi_pri_message);
 #endif
@@ -14345,10 +14342,7 @@
 
 	memset(linksets, 0, sizeof(linksets));
 	for (i = 0; i < NUM_SPANS; i++) {
-		ast_mutex_init(&linksets[i].ss7.lock);
-		linksets[i].ss7.master = AST_PTHREADT_NULL;
-		for (j = 0; j < SIG_SS7_NUM_DCHANS; j++)
-			linksets[i].ss7.fds[j] = -1;
+		sig_ss7_init_linkset(&linksets[i].ss7);
 	}
 	ss7_set_error(dahdi_ss7_error);
 	ss7_set_message(dahdi_ss7_message);
@@ -17407,9 +17401,7 @@
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 	int y;
 #endif	/* defined(HAVE_PRI) || defined(HAVE_SS7) */
-#if defined(HAVE_SS7)
-	int i;
-#endif	/* defined(HAVE_SS7) */
+
 #ifdef HAVE_PRI
 	memset(pris, 0, sizeof(pris));
 	for (y = 0; y < NUM_SPANS; y++) {
@@ -17442,10 +17434,7 @@
 #if defined(HAVE_SS7)
 	memset(linksets, 0, sizeof(linksets));
 	for (y = 0; y < NUM_SPANS; y++) {
-		ast_mutex_init(&linksets[y].ss7.lock);
-		linksets[y].ss7.master = AST_PTHREADT_NULL;
-		for (i = 0; i < SIG_SS7_NUM_DCHANS; i++)
-			linksets[y].ss7.fds[i] = -1;
+		sig_ss7_init_linkset(&linksets[y].ss7);
 	}
 	ss7_set_error(dahdi_ss7_error);
 	ss7_set_message(dahdi_ss7_message);

Modified: trunk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.c?view=diff&rev=270298&r1=270297&r2=270298
==============================================================================
--- trunk/channels/sig_ss7.c (original)
+++ trunk/channels/sig_ss7.c Mon Jun 14 15:51:09 2010
@@ -1609,6 +1609,28 @@
 	return pvt;
 }
 
+/*!
+ * \brief Initialize the SS7 linkset control.
+ * \since 1.8
+ *
+ * \param ss7 sig_ss7 SS7 control structure.
+ *
+ * \return Nothing
+ */
+void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7)
+{
+	int idx;
+
+	memset(ss7, 0, sizeof(*ss7));
+
+	ast_mutex_init(&ss7->lock);
+
+	ss7->master = AST_PTHREADT_NULL;
+	for (idx = 0; idx < ARRAY_LEN(ss7->fds); ++idx) {
+		ss7->fds[idx] = -1;
+	}
+}
+
 /* ------------------------------------------------------------------- */
 
 #endif	/* defined(HAVE_SS7) */

Modified: trunk/channels/sig_ss7.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.h?view=diff&rev=270298&r1=270297&r2=270298
==============================================================================
--- trunk/channels/sig_ss7.h (original)
+++ trunk/channels/sig_ss7.h Mon Jun 14 15:51:09 2010
@@ -253,6 +253,7 @@
 struct ast_channel *sig_ss7_request(struct sig_ss7_chan *p, enum sig_ss7_law law, const struct ast_channel *requestor, int transfercapability);
 void sig_ss7_chan_delete(struct sig_ss7_chan *doomed);
 struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_callback *callback, struct sig_ss7_linkset *ss7);
+void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7);
 
 
 /* ------------------------------------------------------------------- */




More information about the asterisk-commits mailing list