diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-29 08:15:48 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-29 08:15:48 +0000 |
commit | 27da3f292655dc517290a05d67953443b27b01f7 (patch) | |
tree | cca6e9e9b96e5d2ae94b7802b6f15ea6262cfa3f /apps/app_queue.c | |
parent | 1c860479760ffefa316ba17ef109d194c04c9748 (diff) |
avoid multiple strlen calls in complete_queue
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7667 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index c1054de04..17bc06a26 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3360,17 +3360,22 @@ static int queue_show(int fd, int argc, char **argv) static char *complete_queue(char *line, char *word, int pos, int state) { struct ast_call_queue *q; - int which=0; + char *ret = NULL; + int which = 0; + int wordlen = strlen(word); ast_mutex_lock(&qlock); for (q = queues; q; q = q->next) { - if (!strncasecmp(word, q->name, strlen(word))) { - if (++which > state) + if (!strncasecmp(word, q->name, wordlen)) { + if (++which > state) { + ret = strdup(q->name); break; + } } } ast_mutex_unlock(&qlock); - return q ? strdup(q->name) : NULL; + + return ret; } /*!\brief callback to display queues status in manager |