diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-15 19:10:10 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-15 19:10:10 +0000 |
commit | a2c426f29fb2dca512c9b029b839aeeac6963017 (patch) | |
tree | 8a1a80416690533a588361b6c578d0f999f49477 /apps | |
parent | 5fa0b7c277ad400a1029e71d51e83817414129a5 (diff) |
Last batch of 'static' qualifiers for module-level global variables.
Fix up modules in the 'apps' directory, and also correct the bad example of
enum definitions in include/asterisk/app.h, which many developers followed
(thanks for reading the documentation!). In addition, add some basic usage
examples of the 'pahole' and 'pglobal' tools to the coding guidelines.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200656 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_externalivr.c | 4 | ||||
-rw-r--r-- | apps/app_fax.c | 2 | ||||
-rw-r--r-- | apps/app_macro.c | 2 | ||||
-rw-r--r-- | apps/app_minivm.c | 10 | ||||
-rw-r--r-- | apps/app_mixmonitor.c | 10 | ||||
-rw-r--r-- | apps/app_page.c | 4 | ||||
-rw-r--r-- | apps/app_queue.c | 2 | ||||
-rw-r--r-- | apps/app_read.c | 4 | ||||
-rw-r--r-- | apps/app_readexten.c | 4 | ||||
-rw-r--r-- | apps/app_skel.c | 8 | ||||
-rw-r--r-- | apps/app_sms.c | 8 | ||||
-rw-r--r-- | apps/app_stack.c | 2 | ||||
-rw-r--r-- | apps/app_url.c | 4 | ||||
-rw-r--r-- | apps/app_voicemail.c | 12 |
14 files changed, 37 insertions, 39 deletions
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 3a8f0a95d..3a3644923 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -95,11 +95,11 @@ static const char app[] = "ExternalIVR"; /* XXX the parser in gcc 2.95 gets confused if you don't put a space between 'name' and the comma */ #define ast_chan_log(level, channel, format, ...) ast_log(level, "%s: " format, channel->name , ## __VA_ARGS__) -enum { +enum options_flags { noanswer = (1 << 0), ignore_hangup = (1 << 1), run_dead = (1 << 2), -} options_flags; +}; AST_APP_OPTIONS(app_opts, { AST_APP_OPTION('n', noanswer), diff --git a/apps/app_fax.c b/apps/app_fax.c index 8f98af2e7..bd6bdf9f6 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -351,7 +351,7 @@ static int fax_generator_generate(struct ast_channel *chan, void *data, int len, return 0; } -struct ast_generator generator = { +static struct ast_generator generator = { alloc: fax_generator_alloc, generate: fax_generator_generate, }; diff --git a/apps/app_macro.c b/apps/app_macro.c index f3a6b546e..e48d3c361 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -159,7 +159,7 @@ static char *exit_app = "MacroExit"; static void macro_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan); -struct ast_datastore_info macro_ds_info = { +static struct ast_datastore_info macro_ds_info = { .type = "MACRO", .chan_fixup = macro_fixup, }; diff --git a/apps/app_minivm.c b/apps/app_minivm.c index afbd9dc2e..ac48aa50f 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -548,19 +548,19 @@ static char *app_minivm_mwi = "MinivmMWI"; -enum { +enum minivm_option_flags { OPT_SILENT = (1 << 0), OPT_BUSY_GREETING = (1 << 1), OPT_UNAVAIL_GREETING = (1 << 2), OPT_TEMP_GREETING = (1 << 3), OPT_NAME_GREETING = (1 << 4), OPT_RECORDGAIN = (1 << 5), -} minivm_option_flags; +}; -enum { +enum minivm_option_args { OPT_ARG_RECORDGAIN = 0, OPT_ARG_ARRAY_SIZE = 1, -} minivm_option_args; +}; AST_APP_OPTIONS(minivm_app_options, { AST_APP_OPTION('s', OPT_SILENT), @@ -670,7 +670,7 @@ static struct minivm_stats global_stats; AST_MUTEX_DEFINE_STATIC(minivmlock); /*!< Lock to protect voicemail system */ AST_MUTEX_DEFINE_STATIC(minivmloglock); /*!< Lock to protect voicemail system log file */ -FILE *minivmlogfile; /*!< The minivm log file */ +static FILE *minivmlogfile; /*!< The minivm log file */ static int global_vmminmessage; /*!< Minimum duration of messages */ static int global_vmmaxmessage; /*!< Maximum duration of message */ diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index d6e4ed044..d4b8519cb 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -132,8 +132,6 @@ static const char * const app = "MixMonitor"; static const char * const stop_app = "StopMixMonitor"; -struct module_symbols *me; - static const char * const mixmonitor_spy_type = "MixMonitor"; struct mixmonitor { @@ -145,20 +143,20 @@ struct mixmonitor { struct ast_autochan *autochan; }; -enum { +enum mixmonitor_flags { MUXFLAG_APPEND = (1 << 1), MUXFLAG_BRIDGED = (1 << 2), MUXFLAG_VOLUME = (1 << 3), MUXFLAG_READVOLUME = (1 << 4), MUXFLAG_WRITEVOLUME = (1 << 5), -} mixmonitor_flags; +}; -enum { +enum mixmonitor_args { OPT_ARG_READVOLUME = 0, OPT_ARG_WRITEVOLUME, OPT_ARG_VOLUME, OPT_ARG_ARRAY_SIZE, -} mixmonitor_args; +}; AST_APP_OPTIONS(mixmonitor_opts, { AST_APP_OPTION('a', MUXFLAG_APPEND), diff --git a/apps/app_page.c b/apps/app_page.c index b277dab56..04f9f98c5 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -101,13 +101,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ static const char * const app_page= "Page"; -enum { +enum page_opt_flags { PAGE_DUPLEX = (1 << 0), PAGE_QUIET = (1 << 1), PAGE_RECORD = (1 << 2), PAGE_SKIP = (1 << 3), PAGE_IGNORE_FORWARDS = (1 << 4), -} page_opt_flags; +}; AST_APP_OPTIONS(page_opts, { AST_APP_OPTION('d', PAGE_DUPLEX), diff --git a/apps/app_queue.c b/apps/app_queue.c index e32caa78d..bebe543b8 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -977,7 +977,7 @@ struct rule_list { AST_LIST_ENTRY(rule_list) list; }; -AST_LIST_HEAD_STATIC(rule_lists, rule_list); +static AST_LIST_HEAD_STATIC(rule_lists, rule_list); static struct ao2_container *queues; diff --git a/apps/app_read.c b/apps/app_read.c index 3e22d2ef8..a5e4a6434 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -108,11 +108,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") </application> ***/ -enum { +enum read_option_flags { OPT_SKIP = (1 << 0), OPT_INDICATION = (1 << 1), OPT_NOANSWER = (1 << 2), -} read_option_flags; +}; AST_APP_OPTIONS(read_app_options, { AST_APP_OPTION('s', OPT_SKIP), diff --git a/apps/app_readexten.c b/apps/app_readexten.c index ef59aa538..b6b6305a5 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -111,11 +111,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") </function> ***/ -enum { +enum readexten_option_flags { OPT_SKIP = (1 << 0), OPT_INDICATION = (1 << 1), OPT_NOANSWER = (1 << 2), -} readexten_option_flags; +}; AST_APP_OPTIONS(readexten_app_options, { AST_APP_OPTION('s', OPT_SKIP), diff --git a/apps/app_skel.c b/apps/app_skel.c index 1796ab4f5..c58d451e4 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -74,18 +74,18 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "Skel"; -enum { +enum option_flags { OPTION_A = (1 << 0), OPTION_B = (1 << 1), OPTION_C = (1 << 2), -} option_flags; +}; -enum { +enum option_args { OPTION_ARG_B = 0, OPTION_ARG_C = 1, /* This *must* be the last value in this enum! */ OPTION_ARG_ARRAY_SIZE = 2, -} option_args; +}; AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION('a', OPTION_A), diff --git a/apps/app_sms.c b/apps/app_sms.c index a0e0c2fc0..78af84926 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -1832,19 +1832,19 @@ static void sms_process(sms_t * h, int samples, signed short *data) * - AST_APP_OPTIONS() to drive the parsing routine * - in the function, AST_DECLARE_APP_ARGS(...) for the arguments. */ -enum { +enum sms_flags { OPTION_BE_SMSC = (1 << 0), /* act as sms center */ OPTION_ANSWER = (1 << 1), /* answer on incoming calls */ OPTION_TWO = (1 << 2), /* Use Protocol Two */ OPTION_PAUSE = (1 << 3), /* pause before sending data, in ms */ OPTION_SRR = (1 << 4), /* set srr */ OPTION_DCS = (1 << 5), /* set dcs */ -} sms_flags; +}; -enum { +enum sms_opt_args { OPTION_ARG_PAUSE = 0, OPTION_ARG_ARRAY_SIZE -} sms_opt_args; +}; AST_APP_OPTIONS(sms_options, { AST_APP_OPTION('s', OPTION_BE_SMSC), diff --git a/apps/app_stack.c b/apps/app_stack.c index 100a59603..84be40ba2 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -642,7 +642,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char return RESULT_SUCCESS; } -struct agi_command gosub_agi_command = +static struct agi_command gosub_agi_command = { { "gosub", NULL }, handle_gosub, NULL, NULL, 0 }; static int unload_module(void) diff --git a/apps/app_url.c b/apps/app_url.c index 234cff619..a36daa26b 100644 --- a/apps/app_url.c +++ b/apps/app_url.c @@ -82,9 +82,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "SendURL"; -enum { +enum option_flags { OPTION_WAIT = (1 << 0), -} option_flags; +}; AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION('w', OPTION_WAIT), diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 1c14f2e4f..2655fc2ab 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -425,16 +425,16 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate); #define ERROR_LOCK_PATH -100 -enum { +enum vm_box { NEW_FOLDER, OLD_FOLDER, WORK_FOLDER, FAMILY_FOLDER, FRIENDS_FOLDER, GREETINGS_FOLDER -} vm_box; +}; -enum { +enum vm_option_flags { OPT_SILENT = (1 << 0), OPT_BUSY_GREETING = (1 << 1), OPT_UNAVAIL_GREETING = (1 << 2), @@ -444,15 +444,15 @@ enum { OPT_DTMFEXIT = (1 << 7), OPT_MESSAGE_Urgent = (1 << 8), OPT_MESSAGE_PRIORITY = (1 << 9) -} vm_option_flags; +}; -enum { +enum vm_option_args { OPT_ARG_RECORDGAIN = 0, OPT_ARG_PLAYFOLDER = 1, OPT_ARG_DTMFEXIT = 2, /* This *must* be the last value in this enum! */ OPT_ARG_ARRAY_SIZE = 3, -} vm_option_args; +}; AST_APP_OPTIONS(vm_app_options, { AST_APP_OPTION('s', OPT_SILENT), |