[asterisk-commits] eliel: trunk r161218 - in /trunk: apps/ channels/ main/ pbx/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 5 04:31:26 CST 2008


Author: eliel
Date: Fri Dec  5 04:31:25 2008
New Revision: 161218

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161218
Log:
Janitor, use ARRAY_LEN() when possible.

(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)


Modified:
    trunk/apps/app_minivm.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_playback.c
    trunk/apps/app_queue.c
    trunk/apps/app_rpt.c
    trunk/apps/app_voicemail.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_dahdi.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_usbradio.c
    trunk/main/asterisk.c
    trunk/main/astmm.c
    trunk/main/cli.c
    trunk/main/config.c
    trunk/main/db.c
    trunk/main/features.c
    trunk/main/file.c
    trunk/main/frame.c
    trunk/main/http.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/main/translate.c
    trunk/main/udptl.c
    trunk/pbx/pbx_ael.c
    trunk/pbx/pbx_config.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_agi.c
    trunk/res/res_config_ldap.c
    trunk/res/res_config_pgsql.c
    trunk/res/res_config_sqlite.c
    trunk/res/res_convert.c
    trunk/res/res_crypto.c
    trunk/res/res_indications.c
    trunk/res/res_jabber.c
    trunk/res/res_musiconhold.c
    trunk/res/res_odbc.c
    trunk/res/res_realtime.c

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Fri Dec  5 04:31:25 2008
@@ -3281,7 +3281,7 @@
 	if ((res = load_config(0)))
 		return(res);
 
-	ast_cli_register_multiple(cli_minivm, sizeof(cli_minivm)/sizeof(cli_minivm[0]));
+	ast_cli_register_multiple(cli_minivm, ARRAY_LEN(cli_minivm));
 
 	/* compute the location of the voicemail spool directory */
 	snprintf(MVM_SPOOL_DIR, sizeof(MVM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);
@@ -3325,7 +3325,7 @@
 	res |= ast_unregister_application(app_minivm_notify);
 	res |= ast_unregister_application(app_minivm_delete);
 	res |= ast_unregister_application(app_minivm_accmess);
-	ast_cli_unregister_multiple(cli_minivm, sizeof(cli_minivm)/sizeof(cli_minivm[0]));
+	ast_cli_unregister_multiple(cli_minivm, ARRAY_LEN(cli_minivm));
 	ast_custom_function_unregister(&minivm_account_function);
 	ast_custom_function_unregister(&minivm_counter_function);
 

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Fri Dec  5 04:31:25 2008
@@ -452,7 +452,7 @@
 {
 	int res;
 
-	ast_cli_unregister_multiple(cli_mixmonitor, sizeof(cli_mixmonitor) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_mixmonitor, ARRAY_LEN(cli_mixmonitor));
 	res = ast_unregister_application(stop_app);
 	res |= ast_unregister_application(app);
 	
@@ -463,7 +463,7 @@
 {
 	int res;
 
-	ast_cli_register_multiple(cli_mixmonitor, sizeof(cli_mixmonitor) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_mixmonitor, ARRAY_LEN(cli_mixmonitor));
 	res = ast_register_application_xml(app, mixmonitor_exec);
 	res |= ast_register_application_xml(stop_app, stop_mixmonitor_exec);
 

Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Fri Dec  5 04:31:25 2008
@@ -519,7 +519,7 @@
 
 	res = ast_unregister_application(app);
 
-	ast_cli_unregister_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_playback, ARRAY_LEN(cli_playback));
 
 	if (say_cfg)
 		ast_config_destroy(say_cfg);
@@ -542,7 +542,7 @@
 		}
 	}
 
-	ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_playback, ARRAY_LEN(cli_playback));
 	return ast_register_application_xml(app, playback_exec);
 }
 

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Dec  5 04:31:25 2008
@@ -6608,7 +6608,7 @@
 	struct ao2_iterator q_iter;
 	struct call_queue *q = NULL;
 
-	ast_cli_unregister_multiple(cli_queue, sizeof(cli_queue) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_queue, ARRAY_LEN(cli_queue));
 	res = ast_manager_unregister("QueueStatus");
 	res |= ast_manager_unregister("Queues");
 	res |= ast_manager_unregister("QueueRule");
@@ -6669,7 +6669,7 @@
 	if (queue_persistent_members)
 		reload_queue_members();
 
-	ast_cli_register_multiple(cli_queue, sizeof(cli_queue) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_queue, ARRAY_LEN(cli_queue));
 	res = ast_register_application_xml(app, queue_exec);
 	res |= ast_register_application_xml(app_aqm, aqm_exec);
 	res |= ast_register_application_xml(app_rqm, rqm_exec);

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Fri Dec  5 04:31:25 2008
@@ -15108,8 +15108,7 @@
 	res = ast_unregister_application(app);
 
 #ifdef	NEW_ASTERISK
-	ast_cli_unregister_multiple(rpt_cli,sizeof(rpt_cli) / 
-		sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
 #else
 	/* Unregister cli extensions */
 	ast_cli_unregister(&cli_debug);
@@ -15141,8 +15140,7 @@
 	ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
 
 #ifdef	NEW_ASTERISK
-	ast_cli_register_multiple(rpt_cli,sizeof(rpt_cli) / 
-		sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
 	res = 0;
 #else
 	/* Register cli extensions */

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Dec  5 04:31:25 2008
@@ -10793,7 +10793,7 @@
 	res |= ast_unregister_application(app4);
 	res |= ast_custom_function_unregister(&mailbox_exists_acf);
 	res |= ast_manager_unregister("VoicemailUsersList");
-	ast_cli_unregister_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail));
 	ast_uninstall_vm_functions();
 
 	if (poll_thread != AST_PTHREADT_NULL)
@@ -10833,7 +10833,7 @@
 	if (res)
 		return res;
 
-	ast_cli_register_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail));
 
 	ast_install_vm_functions(has_voicemail, inboxcount, inboxcount2, messagecount, sayname);
 	ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, SENTINEL);

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Fri Dec  5 04:31:25 2008
@@ -2600,7 +2600,7 @@
 	ast_manager_register2("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff, "Sets an agent as no longer logged in", mandescr_agent_logoff);
 
 	/* CLI Commands */
-	ast_cli_register_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_agents, ARRAY_LEN(cli_agents));
 
 	/* Dialplan Functions */
 	ast_custom_function_register(&agent_function);
@@ -2632,7 +2632,7 @@
 	/* Unregister dialplan functions */
 	ast_custom_function_unregister(&agent_function);	
 	/* Unregister CLI commands */
-	ast_cli_unregister_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_agents, ARRAY_LEN(cli_agents));
 	/* Unregister dialplan applications */
 	ast_unregister_application(app);
 	ast_unregister_application(app3);

Modified: trunk/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Fri Dec  5 04:31:25 2008
@@ -902,7 +902,7 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	ast_cli_register_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_alsa, ARRAY_LEN(cli_alsa));
 
 	return AST_MODULE_LOAD_SUCCESS;
 }
@@ -910,7 +910,7 @@
 static int unload_module(void)
 {
 	ast_channel_unregister(&alsa_tech);
-	ast_cli_unregister_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_alsa, ARRAY_LEN(cli_alsa));
 
 	if (alsa.icard)
 		snd_pcm_close(alsa.icard);

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Dec  5 04:31:25 2008
@@ -13616,10 +13616,10 @@
 		if (linksets[i].master != AST_PTHREADT_NULL)
 			pthread_cancel(linksets[i].master);
 		}
-	ast_cli_unregister_multiple(dahdi_ss7_cli, sizeof(dahdi_ss7_cli) / sizeof(struct ast_cli_entry));
-#endif
-
-	ast_cli_unregister_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(dahdi_ss7_cli, ARRAY_LEN(dahdi_ss7_cli));
+#endif
+
+	ast_cli_unregister_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
 	ast_manager_unregister( "DAHDIDialOffhook" );
 	ast_manager_unregister( "DAHDIHangup" );
 	ast_manager_unregister( "DAHDITransfer" );

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri Dec  5 04:31:25 2008
@@ -12437,7 +12437,7 @@
 	ast_manager_unregister( "IAXnetstats" );
 	ast_manager_unregister( "IAXregistry" );
 	ast_unregister_application(papp);
-	ast_cli_unregister_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_iax2, ARRAY_LEN(cli_iax2));
 	ast_unregister_switch(&iax2_switch);
 	ast_channel_unregister(&iax2_tech);
 	delete_users();
@@ -12564,7 +12564,7 @@
 	}
 	ast_netsock_init(outsock);
 
-	ast_cli_register_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_iax2, ARRAY_LEN(cli_iax2));
 
 	ast_register_application_xml(papp, iax2_prov_app);
 	

Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Fri Dec  5 04:31:25 2008
@@ -1464,7 +1464,7 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_oss, ARRAY_LEN(cli_oss));
 
 	return AST_MODULE_LOAD_SUCCESS;
 }
@@ -1475,7 +1475,7 @@
 	struct chan_oss_pvt *o, *next;
 
 	ast_channel_unregister(&oss_tech);
-	ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_oss, ARRAY_LEN(cli_oss));
 
 	o = oss_default.next;
 	while (o) {

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Dec  5 04:31:25 2008
@@ -23864,7 +23864,7 @@
 	}
 
 	/* Register all CLI functions for SIP */
-	ast_cli_register_multiple(cli_sip, sizeof(cli_sip)/ sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_sip, ARRAY_LEN(cli_sip));
 
 	/* Tell the RTP subdriver that we're here */
 	ast_rtp_proto_register(&sip_rtp);
@@ -23938,7 +23938,7 @@
 	ast_unregister_application(app_sipaddheader);
 
 	/* Unregister CLI commands */
-	ast_cli_unregister_multiple(cli_sip, sizeof(cli_sip) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_sip, ARRAY_LEN(cli_sip));
 
 	/* Disconnect from the RTP subsystem */
 	ast_rtp_proto_unregister(&sip_rtp);

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Fri Dec  5 04:31:25 2008
@@ -6803,7 +6803,7 @@
 	}
 
 	ast_rtp_proto_register(&skinny_rtp);
-	ast_cli_register_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_skinny, ARRAY_LEN(cli_skinny));
 	sched = sched_context_create();
 	if (!sched) {
 		ast_log(LOG_WARNING, "Unable to create schedule context\n");
@@ -6828,7 +6828,7 @@
 
 	ast_rtp_proto_unregister(&skinny_rtp);
 	ast_channel_unregister(&skinny_tech);
-	ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_skinny, ARRAY_LEN(cli_skinny));
 	
 	AST_LIST_LOCK(&sessions);
 	/* Destroy all the interfaces and free their memory */

Modified: trunk/channels/chan_usbradio.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_usbradio.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/channels/chan_usbradio.c (original)
+++ trunk/channels/chan_usbradio.c Fri Dec  5 04:31:25 2008
@@ -3984,7 +3984,7 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	ast_cli_register_multiple(cli_usbradio, sizeof(cli_usbradio) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
 
 	return AST_MODULE_LOAD_SUCCESS;
 }
@@ -3997,7 +3997,7 @@
 	ast_log(LOG_WARNING, "unload_module() called\n");
 
 	ast_channel_unregister(&usbradio_tech);
-	ast_cli_unregister_multiple(cli_usbradio, sizeof(cli_usbradio) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
 
 	for (o = usbradio_default.next; o; o = o->next) {
 

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Fri Dec  5 04:31:25 2008
@@ -3443,7 +3443,7 @@
 #endif	
 
 	ast_lastreloadtime = ast_startuptime = ast_tvnow();
-	ast_cli_register_multiple(cli_asterisk, sizeof(cli_asterisk) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_asterisk, ARRAY_LEN(cli_asterisk));
 
 	run_startup_commands();
 

Modified: trunk/main/astmm.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astmm.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/astmm.c (original)
+++ trunk/main/astmm.c Fri Dec  5 04:31:25 2008
@@ -487,7 +487,7 @@
 		ast_log(LOG_ERROR, "struct ast_region has %d bytes of padding! This must be eliminated for low-fence checking to work properly!\n", (int) pad);
 	}
 
-	ast_cli_register_multiple(cli_memory, sizeof(cli_memory) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_memory, ARRAY_LEN(cli_memory));
 	
 	snprintf(filename, sizeof(filename), "%s/mmlog", ast_config_AST_LOG_DIR);
 	

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Fri Dec  5 04:31:25 2008
@@ -1602,7 +1602,7 @@
 /*! \brief initialize the _full_cmd string in * each of the builtins. */
 void ast_builtins_init(void)
 {
-	ast_cli_register_multiple(cli_cli, sizeof(cli_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_cli, ARRAY_LEN(cli_cli));
 }
 
 /*!

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Fri Dec  5 04:31:25 2008
@@ -2538,6 +2538,6 @@
 
 int register_config_cli() 
 {
-	ast_cli_register_multiple(cli_config, sizeof(cli_config) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_config, ARRAY_LEN(cli_config));
 	return 0;
 }

Modified: trunk/main/db.c
URL: http://svn.digium.com/view/asterisk/trunk/main/db.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/db.c (original)
+++ trunk/main/db.c Fri Dec  5 04:31:25 2008
@@ -662,7 +662,7 @@
 int astdb_init(void)
 {
 	dbinit();
-	ast_cli_register_multiple(cli_database, sizeof(cli_database) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database));
 	ast_manager_register("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget, "Get DB Entry");
 	ast_manager_register("DBPut", EVENT_FLAG_SYSTEM, manager_dbput, "Put DB Entry");
 	ast_manager_register("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel, "Delete DB Entry");

Modified: trunk/main/features.c
URL: http://svn.digium.com/view/asterisk/trunk/main/features.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Fri Dec  5 04:31:25 2008
@@ -4194,7 +4194,7 @@
 
 	if ((res = load_config()))
 		return res;
-	ast_cli_register_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features));
 	ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL);
 	res = ast_register_application2(parkedcall, park_exec, NULL, NULL, NULL);
 	if (!res)

Modified: trunk/main/file.c
URL: http://svn.digium.com/view/asterisk/trunk/main/file.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Fri Dec  5 04:31:25 2008
@@ -1347,6 +1347,6 @@
 
 int ast_file_init(void)
 {
-	ast_cli_register_multiple(cli_file, sizeof(cli_file) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_file, ARRAY_LEN(cli_file));
 	return 0;
 }

Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Fri Dec  5 04:31:25 2008
@@ -942,7 +942,7 @@
 
 int init_framer(void)
 {
-	ast_cli_register_multiple(my_clis, sizeof(my_clis) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis));
 	return 0;	
 }
 

Modified: trunk/main/http.c
URL: http://svn.digium.com/view/asterisk/trunk/main/http.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/http.c (original)
+++ trunk/main/http.c Fri Dec  5 04:31:25 2008
@@ -1024,7 +1024,7 @@
 {
 	ast_http_uri_link(&statusuri);
 	ast_http_uri_link(&staticuri);
-	ast_cli_register_multiple(cli_http, sizeof(cli_http) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http));
 
 	return __ast_http_load(0);
 }

Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Fri Dec  5 04:31:25 2008
@@ -1013,7 +1013,7 @@
 	}
 
 	/* register the logger cli commands */
-	ast_cli_register_multiple(cli_logger, sizeof(cli_logger) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_logger, ARRAY_LEN(cli_logger));
 
 	ast_mkdir(ast_config_AST_LOG_DIR, 0777);
   

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Fri Dec  5 04:31:25 2008
@@ -4014,7 +4014,7 @@
 		ast_manager_register2("ModuleLoad", EVENT_FLAG_SYSTEM, manager_moduleload, "Module management", mandescr_moduleload);
 		ast_manager_register2("ModuleCheck", EVENT_FLAG_SYSTEM, manager_modulecheck, "Check if module is loaded", mandescr_modulecheck);
 
-		ast_cli_register_multiple(cli_manager, sizeof(cli_manager) / sizeof(struct ast_cli_entry));
+		ast_cli_register_multiple(cli_manager, ARRAY_LEN(cli_manager));
 		ast_extension_state_add(NULL, NULL, manager_state_cb, NULL);
 		registered = 1;
 		/* Append placeholder event so master_eventq never runs dry */

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Dec  5 04:31:25 2008
@@ -9052,11 +9052,11 @@
 	}
 
 	ast_verb(1, "Registering builtin applications:\n");
-	ast_cli_register_multiple(pbx_cli, sizeof(pbx_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(pbx_cli, ARRAY_LEN(pbx_cli));
 	__ast_custom_function_register(&exception_function, NULL);
 
 	/* Register builtin applications */
-	for (x = 0; x < sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
+	for (x = 0; x < ARRAY_LEN(builtins); x++) {
 		ast_verb(1, "[%s]\n", builtins[x].name);
 		if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) {
 			ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);

Modified: trunk/main/translate.c
URL: http://svn.digium.com/view/asterisk/trunk/main/translate.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/translate.c (original)
+++ trunk/main/translate.c Fri Dec  5 04:31:25 2008
@@ -676,7 +676,7 @@
 			    ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt), t->cost);
 
 	if (!added_cli) {
-		ast_cli_register_multiple(cli_translate, sizeof(cli_translate) / sizeof(struct ast_cli_entry));
+		ast_cli_register_multiple(cli_translate, ARRAY_LEN(cli_translate));
 		added_cli++;
 	}
 

Modified: trunk/main/udptl.c
URL: http://svn.digium.com/view/asterisk/trunk/main/udptl.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/main/udptl.c (original)
+++ trunk/main/udptl.c Fri Dec  5 04:31:25 2008
@@ -1245,6 +1245,6 @@
 
 void ast_udptl_init(void)
 {
-	ast_cli_register_multiple(cli_udptl, sizeof(cli_udptl) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_udptl, ARRAY_LEN(cli_udptl));
 	__ast_udptl_reload(0);
 }

Modified: trunk/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_ael.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/pbx/pbx_ael.c (original)
+++ trunk/pbx/pbx_ael.c Fri Dec  5 04:31:25 2008
@@ -214,13 +214,13 @@
 static int unload_module(void)
 {
 	ast_context_destroy(NULL, registrar);
-	ast_cli_unregister_multiple(cli_ael, sizeof(cli_ael) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_ael, ARRAY_LEN(cli_ael));
 	return 0;
 }
 
 static int load_module(void)
 {
-	ast_cli_register_multiple(cli_ael, sizeof(cli_ael) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_ael, ARRAY_LEN(cli_ael));
 	return (pbx_load_module());
 }
 

Modified: trunk/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_config.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Fri Dec  5 04:31:25 2008
@@ -1398,7 +1398,7 @@
 	if (overrideswitch_config) {
 		ast_free(overrideswitch_config);
 	}
-	ast_cli_unregister_multiple(cli_pbx_config, sizeof(cli_pbx_config) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_pbx_config, ARRAY_LEN(cli_pbx_config));
 	ast_context_destroy(NULL, registrar);
 	return 0;
 }
@@ -1738,7 +1738,7 @@
  
 	if (static_config && !write_protect_config)
 		ast_cli_register(&cli_dialplan_save);
-	ast_cli_register_multiple(cli_pbx_config, sizeof(cli_pbx_config) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_pbx_config, ARRAY_LEN(cli_pbx_config));
 
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Fri Dec  5 04:31:25 2008
@@ -4701,7 +4701,7 @@
 		pthread_join(previous_precachethreadid, NULL);
 	}
 
-	ast_cli_unregister_multiple(cli_dundi, sizeof(cli_dundi) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
 	ast_unregister_switch(&dundi_switch);
 	ast_custom_function_unregister(&dundi_function);
 	ast_custom_function_unregister(&dundi_query_function);
@@ -4769,7 +4769,7 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 	
-	ast_cli_register_multiple(cli_dundi, sizeof(cli_dundi) / sizeof(*cli_dundi));
+	ast_cli_register_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
 	if (ast_register_switch(&dundi_switch))
 		ast_log(LOG_ERROR, "Unable to register DUNDi switch\n");
 	ast_custom_function_register(&dundi_function);

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Fri Dec  5 04:31:25 2008
@@ -3257,7 +3257,7 @@
 
 static int unload_module(void)
 {
-	ast_cli_unregister_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_agi, ARRAY_LEN(cli_agi));
 	/* we can safely ignore the result of ast_agi_unregister_multiple() here, since it cannot fail, as
 	   we know that these commands were registered by this module and are still registered
 	*/
@@ -3270,7 +3270,7 @@
 
 static int load_module(void)
 {
-	ast_cli_register_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_agi, ARRAY_LEN(cli_agi));
 	/* we can safely ignore the result of ast_agi_register_multiple() here, since it cannot fail, as
 	   no other commands have been registered yet
 	*/

Modified: trunk/res/res_config_ldap.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_ldap.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_config_ldap.c (original)
+++ trunk/res/res_config_ldap.c Fri Dec  5 04:31:25 2008
@@ -1515,7 +1515,7 @@
 
 	ast_config_engine_register(&ldap_engine);
 	ast_verb(1, "LDAP RealTime driver loaded.\n");
-	ast_cli_register_multiple(ldap_cli, sizeof(ldap_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(ldap_cli, ARRAY_LEN(ldap_cli));
 
 	ast_mutex_unlock(&ldap_lock);
 
@@ -1533,7 +1533,7 @@
 		ldap_unbind_ext_s(ldapConn, NULL, NULL);
 		ldapConn = NULL;
 	}
-	ast_cli_unregister_multiple(ldap_cli, sizeof(ldap_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(ldap_cli, ARRAY_LEN(ldap_cli));
 	ast_config_engine_deregister(&ldap_engine);
 	ast_verb(1, "LDAP RealTime unloaded.\n");
 

Modified: trunk/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_pgsql.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_config_pgsql.c (original)
+++ trunk/res/res_config_pgsql.c Fri Dec  5 04:31:25 2008
@@ -1227,7 +1227,7 @@
 
 	ast_config_engine_register(&pgsql_engine);
 	ast_verb(1, "PostgreSQL RealTime driver loaded.\n");
-	ast_cli_register_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_realtime, ARRAY_LEN(cli_realtime));
 
 	return 0;
 }
@@ -1242,7 +1242,7 @@
 		PQfinish(pgsqlConn);
 		pgsqlConn = NULL;
 	}
-	ast_cli_unregister_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_realtime, ARRAY_LEN(cli_realtime));
 	ast_config_engine_deregister(&pgsql_engine);
 	ast_verb(1, "PostgreSQL RealTime unloaded.\n");
 

Modified: trunk/res/res_config_sqlite.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_sqlite.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_config_sqlite.c (original)
+++ trunk/res/res_config_sqlite.c Fri Dec  5 04:31:25 2008
@@ -1735,7 +1735,7 @@
 static int unload_module(void)
 {
 	if (cli_status_registered)
-		ast_cli_unregister_multiple(cli_status, sizeof(cli_status) / sizeof(struct ast_cli_entry));
+		ast_cli_unregister_multiple(cli_status, ARRAY_LEN(cli_status));
 
 	if (cdr_registered)
 		ast_cdr_unregister(RES_CONFIG_SQLITE_NAME);
@@ -1850,7 +1850,7 @@
 		cdr_registered = 1;
 	}
 
-	error = ast_cli_register_multiple(cli_status, sizeof(cli_status) / sizeof(struct ast_cli_entry));
+	error = ast_cli_register_multiple(cli_status, ARRAY_LEN(cli_status));
 
 	if (error) {
 		unload_module();

Modified: trunk/res/res_convert.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_convert.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_convert.c (original)
+++ trunk/res/res_convert.c Fri Dec  5 04:31:25 2008
@@ -147,13 +147,13 @@
 
 static int unload_module(void)
 {
-	ast_cli_unregister_multiple(cli_convert, sizeof(cli_convert) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_convert, ARRAY_LEN(cli_convert));
 	return 0;
 }
 
 static int load_module(void)
 {
-	ast_cli_register_multiple(cli_convert, sizeof(cli_convert) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_convert, ARRAY_LEN(cli_convert));
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

Modified: trunk/res/res_crypto.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_crypto.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_crypto.c (original)
+++ trunk/res/res_crypto.c Fri Dec  5 04:31:25 2008
@@ -587,7 +587,7 @@
 {
 	SSL_library_init();
 	ERR_load_crypto_strings();
-	ast_cli_register_multiple(cli_crypto, sizeof(cli_crypto) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_crypto, ARRAY_LEN(cli_crypto));
 
 	/* Install ourselves into stubs */
 	ast_key_get = __ast_key_get;

Modified: trunk/res/res_indications.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_indications.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_indications.c (original)
+++ trunk/res/res_indications.c Fri Dec  5 04:31:25 2008
@@ -420,7 +420,7 @@
 	ast_unregister_indication_country(NULL);
 
 	/* and the functions */
-	ast_cli_unregister_multiple(cli_indications, sizeof(cli_indications) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_indications, ARRAY_LEN(cli_indications));
 	ast_unregister_application("PlayTones");
 	ast_unregister_application("StopPlayTones");
 	return 0;
@@ -432,7 +432,7 @@
 {
 	if (ind_load_module(0))
 		return AST_MODULE_LOAD_DECLINE; 
-	ast_cli_register_multiple(cli_indications, sizeof(cli_indications) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications));
 	ast_register_application_xml("PlayTones", handle_playtones);
 	ast_register_application_xml("StopPlayTones", handle_stopplaytones);
 

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Fri Dec  5 04:31:25 2008
@@ -2973,7 +2973,7 @@
 static int unload_module(void)
 {
 
-	ast_cli_unregister_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(aji_cli, ARRAY_LEN(aji_cli));
 	ast_unregister_application(app_ajisend);
 	ast_unregister_application(app_ajistatus);
 	ast_manager_unregister("JabberSend");
@@ -3003,7 +3003,7 @@
 			"Sends a message to a Jabber Client", mandescr_jabber_send);
 	ast_register_application(app_ajisend, aji_send_exec, ajisend_synopsis, ajisend_descrip);
 	ast_register_application(app_ajistatus, aji_status_exec, ajistatus_synopsis, ajistatus_descrip);
-	ast_cli_register_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(aji_cli, ARRAY_LEN(aji_cli));
 	ast_custom_function_register(&jabberstatus_function);
 
 	return 0;

Modified: trunk/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_musiconhold.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Fri Dec  5 04:31:25 2008
@@ -1619,7 +1619,7 @@
 
 	res = ast_register_application(play_moh, play_moh_exec, play_moh_syn, play_moh_desc);
 	ast_register_atexit(ast_moh_destroy);
-	ast_cli_register_multiple(cli_moh, sizeof(cli_moh) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_moh, ARRAY_LEN(cli_moh));
 	if (!res)
 		res = ast_register_application(wait_moh, wait_moh_exec, wait_moh_syn, wait_moh_desc);
 	if (!res)
@@ -1671,7 +1671,7 @@
 	res |= ast_unregister_application(set_moh);
 	res |= ast_unregister_application(start_moh);
 	res |= ast_unregister_application(stop_moh);
-	ast_cli_unregister_multiple(cli_moh, sizeof(cli_moh) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_moh, ARRAY_LEN(cli_moh));
 	ast_unregister_atexit(ast_moh_destroy);
 	return res;
 }

Modified: trunk/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_odbc.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_odbc.c (original)
+++ trunk/res/res_odbc.c Fri Dec  5 04:31:25 2008
@@ -924,7 +924,7 @@
 		return AST_MODULE_LOAD_DECLINE;
 	if (load_odbc_config() == -1)
 		return AST_MODULE_LOAD_DECLINE;
-	ast_cli_register_multiple(cli_odbc, sizeof(cli_odbc) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_odbc, ARRAY_LEN(cli_odbc));
 	ast_log(LOG_NOTICE, "res_odbc loaded.\n");
 	return 0;
 }

Modified: trunk/res/res_realtime.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_realtime.c?view=diff&rev=161218&r1=161217&r2=161218
==============================================================================
--- trunk/res/res_realtime.c (original)
+++ trunk/res/res_realtime.c Fri Dec  5 04:31:25 2008
@@ -251,13 +251,13 @@
 
 static int unload_module(void)
 {
-	ast_cli_unregister_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(cli_realtime, ARRAY_LEN(cli_realtime));
 	return 0;
 }
 
 static int load_module(void)
 {
-	ast_cli_register_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_realtime, ARRAY_LEN(cli_realtime));
 	return AST_MODULE_LOAD_SUCCESS;
 }
 




More information about the asterisk-commits mailing list