From 12ff77f9757d240de38f0a3d6ed569831eeecf95 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sun, 7 Jun 2009 14:55:51 +0000 Subject: [PATCH] Global var cleanup - constification and removing unused vars. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199479 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_adsiprog.c | 4 ++-- apps/app_alarmreceiver.c | 2 +- apps/app_amd.c | 2 +- apps/app_authenticate.c | 4 ++-- apps/app_chanisavail.c | 2 +- apps/app_channelredirect.c | 2 +- apps/app_chanspy.c | 10 +++++----- apps/app_confbridge.c | 2 +- apps/app_controlplayback.c | 2 +- apps/app_dahdibarge.c | 2 +- apps/app_dahdiras.c | 2 +- apps/app_db.c | 5 ++--- apps/app_dial.c | 4 ++-- apps/app_dictate.c | 2 +- apps/app_directed_pickup.c | 4 ++-- apps/app_directory.c | 4 ++-- apps/app_disa.c | 4 ++-- apps/app_dumpchan.c | 2 +- apps/app_echo.c | 2 +- apps/app_exec.c | 6 +++--- apps/app_fax.c | 4 ++-- 21 files changed, 35 insertions(+), 36 deletions(-) diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index b889f96f1d..ae302a1e36 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -45,7 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/lock.h" -static char *app = "ADSIProg"; +static const char app[] = "ADSIProg"; /*** DOCUMENTATION @@ -71,7 +71,7 @@ static char *app = "ADSIProg"; struct adsi_event { int id; - char *name; + const char *name; }; static const struct adsi_event events[] = { diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index c6fa8980b4..47e894b1e7 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -62,7 +62,7 @@ struct event_node{ typedef struct event_node event_node_t; -static char *app = "AlarmReceiver"; +static const char app[] = "AlarmReceiver"; /*** DOCUMENTATION diff --git a/apps/app_amd.c b/apps/app_amd.c index cedd3b67a8..c5f08aba63 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -124,7 +124,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "AMD"; +static const char app[] = "AMD"; #define STATE_IN_WORD 1 #define STATE_IN_SILENCE 2 diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 19570255c1..416ea432d6 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -43,7 +43,7 @@ enum { OPT_DATABASE = (1 << 1), OPT_MULTIPLE = (1 << 3), OPT_REMOVE = (1 << 4), -} auth_option_flags; +}; AST_APP_OPTIONS(auth_app_options, { AST_APP_OPTION('a', OPT_ACCOUNT), @@ -53,7 +53,7 @@ AST_APP_OPTIONS(auth_app_options, { }); -static char *app = "Authenticate"; +static const char app[] = "Authenticate"; /*** DOCUMENTATION diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index c7af4af7dc..b1c426af55 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -41,7 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/devicestate.h" -static char *app = "ChanIsAvail"; +static const char app[] = "ChanIsAvail"; /*** DOCUMENTATION diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index 7271621946..57c9234ef3 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -60,7 +60,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "ChannelRedirect"; +static const char app[] = "ChannelRedirect"; static int asyncgoto_exec(struct ast_channel *chan, const char *data) { diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index c3d0f901e1..2961cc57ed 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -325,11 +325,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static const char * const app_chan = "ChanSpy"; +static const char app_chan[] = "ChanSpy"; -static const char * const app_ext = "ExtenSpy"; +static const char app_ext[] = "ExtenSpy"; -static const char * const app_dahdiscan = "DAHDIScan"; +static const char app_dahdiscan[] = "DAHDIScan"; enum { OPTION_QUIET = (1 << 0), /* Quiet, no announcement */ @@ -349,7 +349,7 @@ enum { OPTION_DTMF_EXIT = (1 << 14), /* Set DTMF to exit, added for DAHDIScan integration */ OPTION_DTMF_CYCLE = (1 << 15), /* Custom DTMF for cycling next avaliable channel, (default is '*') */ OPTION_DAHDI_SCAN = (1 << 16), /* Scan groups in DAHDIScan mode */ -} chanspy_opt_flags; +}; enum { OPT_ARG_VOLUME = 0, @@ -360,7 +360,7 @@ enum { OPT_ARG_EXIT, OPT_ARG_CYCLE, OPT_ARG_ARRAY_SIZE, -} chanspy_opt_args; +}; AST_APP_OPTIONS(spy_opts, { AST_APP_OPTION('q', OPTION_QUIET), diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index d7a0bad401..bb68f365ab 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -111,7 +111,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * bridge lock if it is important. */ -static const char * const app = "ConfBridge"; +static const char app[] = "ConfBridge"; enum { OPTION_ADMIN = (1 << 0), /*!< Set if the caller is an administrator */ diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c index 11a162d58c..1d6dcec471 100644 --- a/apps/app_controlplayback.c +++ b/apps/app_controlplayback.c @@ -92,7 +92,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static const char * const app = "ControlPlayback"; +static const char app[] = "ControlPlayback"; enum { OPT_OFFSET = (1 << 1), diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c index 124318115d..7034af0d13 100644 --- a/apps/app_dahdibarge.c +++ b/apps/app_dahdibarge.c @@ -70,7 +70,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "DAHDIBarge"; +static const char app[] = "DAHDIBarge"; #define CONF_SIZE 160 diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c index 67f434e6f2..b467b16b8b 100644 --- a/apps/app_dahdiras.c +++ b/apps/app_dahdiras.c @@ -73,7 +73,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "DAHDIRAS"; +static const char app[] = "DAHDIRAS"; #define PPP_MAX_ARGS 32 #define PPP_EXEC "/usr/sbin/pppd" diff --git a/apps/app_db.c b/apps/app_db.c index 8171ed2027..99679e71b0 100644 --- a/apps/app_db.c +++ b/apps/app_db.c @@ -79,9 +79,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -/*! \todo XXX Remove this application after 1.4 is relased */ -static char *d_app = "DBdel"; -static char *dt_app = "DBdeltree"; +static const char d_app[] = "DBdel"; +static const char dt_app[] = "DBdeltree"; static int deltree_exec(struct ast_channel *chan, const char *data) { diff --git a/apps/app_dial.c b/apps/app_dial.c index 7ab2b84a18..a9522652bb 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -465,8 +465,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "Dial"; -static char *rapp = "RetryDial"; +static const char app[] = "Dial"; +static const char rapp[] = "RetryDial"; enum { OPT_ANNOUNCE = (1 << 0), diff --git a/apps/app_dictate.c b/apps/app_dictate.c index d940b67fc8..816f15a14a 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -55,7 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "Dictate"; +static const char app[] = "Dictate"; typedef enum { DFLAG_RECORD = (1 << 0), diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 2e196a7d8f..69015a0908 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -84,8 +84,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static const char * const app = "Pickup"; -static const char * const app2 = "PickupChan"; +static const char app[] = "Pickup"; +static const char app2[] = "PickupChan"; /*! \todo This application should return a result code, like PICKUPRESULT */ /* Perform actual pickup between two channels */ diff --git a/apps/app_directory.c b/apps/app_directory.c index d0172e79ed..e1f5fb27b3 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -113,7 +113,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "Directory"; +static const char app[] = "Directory"; /* For simplicity, I'm keeping the format compatible with the voicemail config, but i'm open to suggestions for isolating it */ @@ -128,7 +128,7 @@ enum { OPT_LISTBYLASTNAME = (1 << 4), OPT_LISTBYEITHER = OPT_LISTBYFIRSTNAME | OPT_LISTBYLASTNAME, OPT_PAUSE = (1 << 5), -} directory_option_flags; +}; enum { OPT_ARG_FIRSTNAME = 0, diff --git a/apps/app_disa.c b/apps/app_disa.c index b7ca23cfcd..b86b8f634a 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -110,12 +110,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "DISA"; +static const char app[] = "DISA"; enum { NOANSWER_FLAG = (1 << 0), POUND_TO_END_FLAG = (1 << 1), -} option_flags; +}; AST_APP_OPTIONS(app_opts, { AST_APP_OPTION('n', NOANSWER_FLAG), diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 476f2f1fd7..a7b4fc001e 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -60,7 +60,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "DumpChan"; +static const char app[] = "DumpChan"; static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) { diff --git a/apps/app_echo.c b/apps/app_echo.c index dcdebed461..ac718b8b95 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -46,7 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app = "Echo"; +static const char app[] = "Echo"; static int echo_exec(struct ast_channel *chan, const char *data) { diff --git a/apps/app_exec.c b/apps/app_exec.c index b840e24b9b..6ffc0bca99 100644 --- a/apps/app_exec.c +++ b/apps/app_exec.c @@ -125,9 +125,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * affecting the dialplan. */ -static char *app_exec = "Exec"; -static char *app_tryexec = "TryExec"; -static char *app_execif = "ExecIf"; +static const char app_exec[] = "Exec"; +static const char app_tryexec[] = "TryExec"; +static const char app_execif[] = "ExecIf"; static int exec_exec(struct ast_channel *chan, const char *data) { diff --git a/apps/app_fax.c b/apps/app_fax.c index 6cb18848ee..8f98af2e77 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -141,8 +141,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ -static char *app_sndfax_name = "SendFAX"; -static char *app_rcvfax_name = "ReceiveFAX"; +static const char app_sndfax_name[] = "SendFAX"; +static const char app_rcvfax_name[] = "ReceiveFAX"; #define MAX_SAMPLES 240