[svn-commits] russell: trunk r105984 - /trunk/apps/app_queue.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Mar 4 22:34:30 CST 2008
Author: russell
Date: Tue Mar 4 22:34:29 2008
New Revision: 105984
URL: http://svn.digium.com/view/asterisk?view=rev&rev=105984
Log:
- simplify a few statements with ARRAY_LEN()
- constify the stregy int to string mappings array
Modified:
trunk/apps/app_queue.c
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=105984&r1=105983&r2=105984
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Mar 4 22:34:29 2008
@@ -117,9 +117,9 @@
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 @@
{
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 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 @@
{
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 void set_queue_variables(struct queue_ent *qe)
{
-
char interfacevar[256]="";
float sl = 0;
More information about the svn-commits
mailing list