mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
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
This commit is contained in:
@@ -255,8 +255,8 @@ static char *handle_cli_devstate_change(struct ast_cli_entry *e, int cmd, struct
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
{
|
||||
static char * const cmds[] = { "UNKNOWN", "NOT_INUSE", "INUSE", "BUSY",
|
||||
"UNAVAILABLE", "RINGING", "RINGINUSE", "ONHOLD", NULL };
|
||||
static const char * const cmds[] = { "UNKNOWN", "NOT_INUSE", "INUSE", "BUSY",
|
||||
"UNAVAILABLE", "RINGING", "RINGINUSE", "ONHOLD", NULL };
|
||||
|
||||
if (a->pos == e->args + 1)
|
||||
return ast_cli_complete(a->word, cmds, a->n);
|
||||
|
||||
@@ -732,7 +732,7 @@ static struct ast_custom_function fetch_function = {
|
||||
|
||||
static char *app_odbcfinish = "ODBCFinish";
|
||||
|
||||
static int exec_odbcfinish(struct ast_channel *chan, void *data)
|
||||
static int exec_odbcfinish(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
struct ast_datastore *store = ast_channel_datastore_find(chan, &odbc_info, data);
|
||||
if (!store) /* Already freed; no big deal. */
|
||||
|
||||
@@ -654,7 +654,7 @@ static void clearvar_prefix(struct ast_channel *chan, const char *prefix)
|
||||
AST_LIST_TRAVERSE_SAFE_END
|
||||
}
|
||||
|
||||
static int exec_clearhash(struct ast_channel *chan, void *data)
|
||||
static int exec_clearhash(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
char prefix[80];
|
||||
snprintf(prefix, sizeof(prefix), HASH_PREFIX, data ? (char *)data : "null");
|
||||
|
||||
Reference in New Issue
Block a user