Index: pbx/pbx_config.c
===================================================================
--- pbx/pbx_config.c	(revision 159892)
+++ pbx/pbx_config.c	(working copy)
@@ -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;
 }
Index: pbx/pbx_ael.c
===================================================================
--- pbx/pbx_ael.c	(revision 159892)
+++ pbx/pbx_ael.c	(working copy)
@@ -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());
 }
 
Index: pbx/pbx_dundi.c
===================================================================
--- pbx/pbx_dundi.c	(revision 159892)
+++ pbx/pbx_dundi.c	(working copy)
@@ -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);
Index: channels/chan_usbradio.c
===================================================================
--- channels/chan_usbradio.c	(revision 159892)
+++ channels/chan_usbradio.c	(working copy)
@@ -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) {
 
Index: channels/chan_dahdi.c
===================================================================
--- channels/chan_dahdi.c	(revision 159892)
+++ channels/chan_dahdi.c	(working copy)
@@ -13612,10 +13612,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));
+	ast_cli_unregister_multiple(dahdi_ss7_cli, ARRAY_LEN(dahdi_ss7_cli));
 #endif
 
-	ast_cli_unregister_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_unregister_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
 	ast_manager_unregister( "DAHDIDialOffhook" );
 	ast_manager_unregister( "DAHDIHangup" );
 	ast_manager_unregister( "DAHDITransfer" );
Index: channels/chan_sip.c
===================================================================
--- channels/chan_sip.c	(revision 159892)
+++ channels/chan_sip.c	(working copy)
@@ -23837,7 +23837,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);
@@ -23911,7 +23911,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);
Index: channels/chan_agent.c
===================================================================
--- channels/chan_agent.c	(revision 159892)
+++ channels/chan_agent.c	(working copy)
@@ -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);
Index: channels/chan_iax2.c
===================================================================
--- channels/chan_iax2.c	(revision 159892)
+++ channels/chan_iax2.c	(working copy)
@@ -12407,7 +12407,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();
@@ -12534,7 +12534,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);
 	
Index: channels/chan_oss.c
===================================================================
--- channels/chan_oss.c	(revision 159892)
+++ channels/chan_oss.c	(working copy)
@@ -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) {
Index: channels/chan_skinny.c
===================================================================
--- channels/chan_skinny.c	(revision 159892)
+++ channels/chan_skinny.c	(working copy)
@@ -6644,7 +6644,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");
@@ -6669,7 +6669,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 */
Index: channels/chan_alsa.c
===================================================================
--- channels/chan_alsa.c	(revision 159892)
+++ channels/chan_alsa.c	(working copy)
@@ -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);
Index: apps/app_rpt.c
===================================================================
--- apps/app_rpt.c	(revision 159892)
+++ apps/app_rpt.c	(working copy)
@@ -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 */
Index: apps/app_mixmonitor.c
===================================================================
--- apps/app_mixmonitor.c	(revision 159892)
+++ apps/app_mixmonitor.c	(working copy)
@@ -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);
 
Index: apps/app_minivm.c
===================================================================
--- apps/app_minivm.c	(revision 159892)
+++ apps/app_minivm.c	(working copy)
@@ -3274,7 +3274,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);
@@ -3318,7 +3318,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);
 
Index: apps/app_voicemail.c
===================================================================
--- apps/app_voicemail.c	(revision 159892)
+++ apps/app_voicemail.c	(working copy)
@@ -10782,7 +10782,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)
@@ -10822,7 +10822,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);
Index: apps/app_playback.c
===================================================================
--- apps/app_playback.c	(revision 159892)
+++ apps/app_playback.c	(working copy)
@@ -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);
 }
 
Index: apps/app_queue.c
===================================================================
--- apps/app_queue.c	(revision 159892)
+++ apps/app_queue.c	(working copy)
@@ -6607,7 +6607,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");
@@ -6668,7 +6668,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);
Index: main/config.c
===================================================================
--- main/config.c	(revision 159892)
+++ main/config.c	(working copy)
@@ -2536,6 +2536,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;
 }
Index: main/manager.c
===================================================================
--- main/manager.c	(revision 159892)
+++ main/manager.c	(working copy)
@@ -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 */
Index: main/features.c
===================================================================
--- main/features.c	(revision 159892)
+++ main/features.c	(working copy)
@@ -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)
Index: main/http.c
===================================================================
--- main/http.c	(revision 159892)
+++ main/http.c	(working copy)
@@ -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);
 }
Index: main/db.c
===================================================================
--- main/db.c	(revision 159892)
+++ main/db.c	(working copy)
@@ -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");
Index: main/translate.c
===================================================================
--- main/translate.c	(revision 159892)
+++ main/translate.c	(working copy)
@@ -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++;
 	}
 
Index: main/astmm.c
===================================================================
--- main/astmm.c	(revision 159892)
+++ main/astmm.c	(working copy)
@@ -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);
 	
Index: main/asterisk.c
===================================================================
--- main/asterisk.c	(revision 159892)
+++ main/asterisk.c	(working copy)
@@ -3381,7 +3381,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();
 
Index: main/udptl.c
===================================================================
--- main/udptl.c	(revision 159892)
+++ main/udptl.c	(working copy)
@@ -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);
 }
Index: main/frame.c
===================================================================
--- main/frame.c	(revision 159892)
+++ main/frame.c	(working copy)
@@ -939,7 +939,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;	
 }
 
Index: main/cli.c
===================================================================
--- main/cli.c	(revision 159892)
+++ main/cli.c	(working copy)
@@ -1208,7 +1208,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));
 }
 
 static struct ast_cli_entry *cli_next(struct ast_cli_entry *e)
Index: main/logger.c
===================================================================
--- main/logger.c	(revision 159892)
+++ main/logger.c	(working copy)
@@ -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);
   
Index: main/pbx.c
===================================================================
--- main/pbx.c	(revision 159892)
+++ main/pbx.c	(working copy)
@@ -9047,11 +9047,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);
Index: main/file.c
===================================================================
--- main/file.c	(revision 159892)
+++ main/file.c	(working copy)
@@ -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;
 }
Index: res/res_config_sqlite.c
===================================================================
--- res/res_config_sqlite.c	(revision 159892)
+++ res/res_config_sqlite.c	(working copy)
@@ -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();
Index: res/res_agi.c
===================================================================
--- res/res_agi.c	(revision 159892)
+++ res/res_agi.c	(working copy)
@@ -3225,7 +3225,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
 	*/
@@ -3238,7 +3238,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
 	*/
Index: res/res_config_ldap.c
===================================================================
--- res/res_config_ldap.c	(revision 159892)
+++ res/res_config_ldap.c	(working copy)
@@ -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");
 
Index: res/res_odbc.c
===================================================================
--- res/res_odbc.c	(revision 159892)
+++ res/res_odbc.c	(working copy)
@@ -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;
 }
Index: res/res_convert.c
===================================================================
--- res/res_convert.c	(revision 159892)
+++ res/res_convert.c	(working copy)
@@ -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;
 }
 
Index: res/res_jabber.c
===================================================================
--- res/res_jabber.c	(revision 159892)
+++ res/res_jabber.c	(working copy)
@@ -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;
Index: res/res_realtime.c
===================================================================
--- res/res_realtime.c	(revision 159892)
+++ res/res_realtime.c	(working copy)
@@ -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;
 }
 
Index: res/res_indications.c
===================================================================
--- res/res_indications.c	(revision 159892)
+++ res/res_indications.c	(working copy)
@@ -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);
 
Index: res/res_config_pgsql.c
===================================================================
--- res/res_config_pgsql.c	(revision 159892)
+++ res/res_config_pgsql.c	(working copy)
@@ -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");
 
Index: res/res_crypto.c
===================================================================
--- res/res_crypto.c	(revision 159892)
+++ res/res_crypto.c	(working copy)
@@ -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;
Index: res/res_musiconhold.c
===================================================================
--- res/res_musiconhold.c	(revision 159892)
+++ res/res_musiconhold.c	(working copy)
@@ -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;
 }
