From e6b2e9a7501b5d2e351a5e626fa13dfc3c113f1e Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Thu, 21 May 2009 21:13:09 +0000 Subject: Const-ify the world (or at least a good part of it) This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes: - CLI command handlers - CLI command handler arguments - AGI command handlers - AGI command handler arguments - Dialplan application handler arguments - Speech engine API function arguments In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing. Review: https://reviewboard.asterisk.org/r/251/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx/dundi-parser.c | 2 +- pbx/pbx_ael.c | 2 +- pbx/pbx_config.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'pbx') diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c index 15dae84d6..3c57442a4 100644 --- a/pbx/dundi-parser.c +++ b/pbx/dundi-parser.c @@ -155,7 +155,7 @@ static void dump_hint(char *output, int maxlen, void *value, int len) static void dump_cause(char *output, int maxlen, void *value, int len) { - static char *causes[] = { + static const char * const causes[] = { "SUCCESS", "GENERAL", "DYNAMIC", diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index f1b8fb00e..f6371f1e4 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -251,7 +251,7 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Extension Langu ); #ifdef AAL_ARGCHECK -static char *ael_funclist[] = +static const char * const ael_funclist[] = { "AGENT", "ARRAY", diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 5bd106db2..8bebf1385 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -328,7 +328,7 @@ static char *handle_cli_dialplan_remove_extension(struct ast_cli_entry *e, int c * Priority input checking ... */ if (a->argc == 5) { - char *c = a->argv[4]; + const char *c = a->argv[4]; /* check for digits in whole parameter for right priority ... * why? because atoi (strtol) returns 0 if any characters in @@ -935,8 +935,7 @@ static char *handle_cli_dialplan_add_extension(struct ast_cli_entry *e, int cmd, if (strcmp(a->argv[6], "replace")) return CLI_SHOWUSAGE; - /* XXX overwrite argv[3] */ - whole_exten = a->argv[3]; + whole_exten = ast_strdupa(a->argv[3]); exten = strsep(&whole_exten,","); if (strchr(exten, '/')) { cidmatch = exten; -- cgit v1.2.3