From 5403b28778800035e62e5b861712640bbc32058c Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 5 Mar 2008 04:34:29 +0000 Subject: - simplify a few statements with ARRAY_LEN() - constify the stregy int to string mappings array git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105984 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_queue.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'apps') diff --git a/apps/app_queue.c b/apps/app_queue.c index f1df7373c..5ab932c1c 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -117,9 +117,9 @@ enum { QUEUE_STRATEGY_WRANDOM }; -static struct strategy { +static const struct strategy { int strategy; - char *name; + const char *name; } strategies[] = { { QUEUE_STRATEGY_RINGALL, "ringall" }, { QUEUE_STRATEGY_LEASTRECENT, "leastrecent" }, @@ -516,7 +516,7 @@ static void set_queue_result(struct ast_channel *chan, enum queue_result res) { int i; - for (i = 0; i < sizeof(queue_results) / sizeof(queue_results[0]); i++) { + for (i = 0; i < ARRAY_LEN(queue_results); i++) { if (queue_results[i].id == res) { pbx_builtin_setvar_helper(chan, "QUEUESTATUS", queue_results[i].text); return; @@ -524,11 +524,11 @@ static void set_queue_result(struct ast_channel *chan, enum queue_result res) } } -static char *int2strat(int strategy) +static const char *int2strat(int strategy) { int x; - for (x = 0; x < sizeof(strategies) / sizeof(strategies[0]); x++) { + for (x = 0; x < ARRAY_LEN(strategies); x++) { if (strategy == strategies[x].strategy) return strategies[x].name; } @@ -540,7 +540,7 @@ static int strat2int(const char *strategy) { int x; - for (x = 0; x < sizeof(strategies) / sizeof(strategies[0]); x++) { + for (x = 0; x < ARRAY_LEN(strategies); x++) { if (!strcasecmp(strategy, strategies[x].name)) return strategies[x].strategy; } @@ -574,7 +574,6 @@ static inline struct call_queue *queue_unref(struct call_queue *q) static void set_queue_variables(struct queue_ent *qe) { - char interfacevar[256]=""; float sl = 0; -- cgit v1.2.3