[asterisk-commits] nadi: branch nadi/trunk-cm r44864 - /team/nadi/trunk-cm/channels/chan_misdn.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Oct 11 05:02:11 MST 2006


Author: nadi
Date: Wed Oct 11 07:02:11 2006
New Revision: 44864

URL: http://svn.digium.com/view/asterisk?rev=44864&view=rev
Log:
minor fixes (typos at most)

Modified:
    team/nadi/trunk-cm/channels/chan_misdn.c

Modified: team/nadi/trunk-cm/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/nadi/trunk-cm/channels/chan_misdn.c?rev=44864&r1=44863&r2=44864&view=diff
==============================================================================
--- team/nadi/trunk-cm/channels/chan_misdn.c (original)
+++ team/nadi/trunk-cm/channels/chan_misdn.c Wed Oct 11 07:02:11 2006
@@ -209,7 +209,7 @@
 
 static int                  * misdn_debug = NULL,
                             * misdn_debug_only = NULL,
-                            * misdn_ports = NULL;
+                            * misdn_ports;
 
 static AST_HASH_STR(, struct csel *) group_csel_hash;
 
@@ -544,14 +544,11 @@
 	if (cfg_debug < 0)
 		cfg_debug = 0;
 
-	misdn_debug = (int *)malloc(sizeof(int) * (max_ports + 1));
-	misdn_debug_only = (int *)calloc(max_ports + 1, sizeof(int));
-	misdn_ports = (int *)malloc(sizeof(int) * (max_ports + 1));
-
-	for (i = 0;  i <= max_ports; ++i) {
+	misdn_debug = malloc(sizeof(int) * (max_ports + 1));
+	misdn_debug_only = calloc(max_ports + 1, sizeof(int));
+
+	for (i = 0;  i <= max_ports; ++i)
 		misdn_debug[i] = cfg_debug;
-		misdn_ports[i] = i;
-	}
 
 	return 0;
 }
@@ -568,10 +565,6 @@
 	}
 	if (misdn_debug_only) {
 		free(misdn_debug_only);
-		misdn_debug_only = NULL;
-	}
-	if (misdn_ports) {
-		free(misdn_ports);
 		misdn_debug_only = NULL;
 	}
 }
@@ -2098,13 +2091,13 @@
 	{ {"misdn", "show", "channels", NULL}, misdn_show_cls, "Shows internal mISDN chan_list",
 		"Usage: misdn show channels\n" },
 	{ {"misdn", "show", "channel", NULL}, misdn_show_cl, "Shows internal mISDN chan_list",
-		"Usage: misdn show channels\n", complete_ch },
+		"Usage: misdn show channel <channel>\n", complete_ch },
 	{ {"misdn", "port", "block", NULL}, misdn_port_block, "Blocks the given port",
-		"Usage: misdn port block\n" },
+		"Usage: misdn port block <port>\n" },
 	{ {"misdn", "port", "unblock", NULL}, misdn_port_unblock, "Unblocks the given port",
-		"Usage: misdn port unblock\n" },
+		"Usage: misdn port unblock <port>\n" },
 	{ {"misdn", "restart", "port", NULL}, misdn_restart_port, "Restarts the given port",
-		"Usage: misdn restart port\n" },
+		"Usage: misdn restart port <port>\n" },
 	{ {"misdn", "port", "up", NULL}, misdn_port_up, "Tries to establish L1 on the given port",
 		"Usage: misdn port up <port>\n" },
 	{ {"misdn", "port", "down", NULL}, misdn_port_down, "Tries to deacivate the L1 on the given port",
@@ -2804,7 +2797,7 @@
 
 	chan_misdn_log(1, bc->port,
 				   "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n"
-				   "--> l3id:%x\n --> cause:%d\n --> out_cause:%d\n --> state:%s\n",
+				   " --> l3id:%x\n --> cause:%d\n --> out_cause:%d\n --> state:%s\n",
 				   p->bc ? p->bc->pid : -1, ast->context, ast->exten, AST_CID_P(ast), get_ch_state(p),
 				   p->l3id, bc->cause, bc->out_cause, get_ch_state(p));
 
@@ -4114,6 +4107,7 @@
 	ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
 
 	misdn_tasks_destroy();
+	free(misdn_ports);
 	ast_cli_unregister_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(struct ast_cli_entry));
 	ast_unregister_application("misdn_set_opt");
 	ast_unregister_application("misdn_facility");
@@ -4121,7 +4115,7 @@
 	misdn_csel_destroy();
 	misdn_lib_destroy();
 	config_destroy();
-	
+
 	return 0;
 }
 
@@ -4204,7 +4198,9 @@
 
 	cm_get(misdn_cm, tracefile, sizeof(tracefile), GENERAL, MCFG_TRACEFILE);
 
+	misdn_ports = malloc(sizeof(int) * (max_ports + 1));
 	for (prev = NULL; cm_get_next_id(misdn_cm, PORT, prev, &port); prev = &port) {
+		misdn_ports[port] = port;
 		l1timeout = 0;
 		cm_get_int(misdn_cm, l1timeout, PORT, MCFG_L1WATCHER_TIMEOUT, port);
 		if (l1timeout) {



More information about the asterisk-commits mailing list