summaryrefslogtreecommitdiff
path: root/apps/app_followme.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-05-08 22:25:42 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-05-08 22:25:42 +0000
commitb888b6bf234ff6fd602f434a88f0f27e8930de5f (patch)
treef48f51bd197ed512875308526923b08caff64ef0 /apps/app_followme.c
parentc8945a4070419392af7a0ae3283585fb7c491a0e (diff)
Make FollowMe findmeexec() put the list head on the stack instead of mallocing it.
Why this tiny struct was malloced instead of the 28k struct in the last change is beyond me. Just doing my part to help stamp out sillyness. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_followme.c')
-rw-r--r--apps/app_followme.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 7e14ffcf9..c23e2a328 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -906,14 +906,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
char *rest, *number;
struct findme_user *tmpuser;
struct findme_user *fmuser;
- struct findme_user_listptr *findme_user_list;
-
- findme_user_list = ast_calloc(1, sizeof(*findme_user_list));
- if (!findme_user_list) {
- ast_log(LOG_WARNING, "Failed to allocate memory for findme_user_list\n");
- return NULL;
- }
- AST_LIST_HEAD_INIT_NOLOCK(findme_user_list);
+ struct findme_user_listptr findme_user_list = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
for (idx = 1; !ast_check_hangup(caller); ++idx) {
/* Find next followme numbers to dial. */
@@ -969,7 +962,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
tmpuser->state = 0;
tmpuser->cleared = 0;
ast_copy_string(tmpuser->dialarg, dialarg, sizeof(dialarg));
- AST_LIST_INSERT_TAIL(findme_user_list, tmpuser, entry);
+ AST_LIST_INSERT_TAIL(&findme_user_list, tmpuser, entry);
} else {
ast_verb(3, "couldn't reach at this number.\n");
ast_channel_lock(outbound);
@@ -1002,17 +995,17 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
}
}
- if (AST_LIST_EMPTY(findme_user_list)) {
+ if (AST_LIST_EMPTY(&findme_user_list)) {
continue;
}
- winner = wait_for_winner(findme_user_list, nm, caller, tpargs->namerecloc, tpargs);
+ winner = wait_for_winner(&findme_user_list, nm, caller, tpargs->namerecloc, tpargs);
if (!winner) {
continue;
}
/* Destroy losing calls up to the winner. The rest will be destroyed later. */
- while ((fmuser = AST_LIST_REMOVE_HEAD(findme_user_list, entry))) {
+ while ((fmuser = AST_LIST_REMOVE_HEAD(&findme_user_list, entry))) {
if (fmuser->ochan == winner) {
/* Pass any connected line info up. */
tpargs->connected_out = fmuser->connected;
@@ -1030,7 +1023,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
}
break;
}
- destroy_calling_tree(findme_user_list);
+ destroy_calling_tree(&findme_user_list);
return winner;
}