aboutsummaryrefslogtreecommitdiffstats
path: root/main/features.c
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-09 01:59:59 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-09 01:59:59 +0000
commit2034723f38d4ae9c8eb29f45c5611e834ff6cfa9 (patch)
tree5e7ff2cd6ece5b2ac5438a59b2737c5705b928cc /main/features.c
parent70ff546e20c930fe8c28001a7cef10d8ee569896 (diff)
In order to move away from nested function use, some changes to the recently introduced
ast_channel_search_locked need to be made. Specifically, the caller needs to be able to pass arbitrary data which in turn is passed to the callback. This patch addresses all of the nested functions currently in asterisk trunk. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@155590 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/main/features.c b/main/features.c
index ed13ee4fc..932f1b8a1 100644
--- a/main/features.c
+++ b/main/features.c
@@ -3987,6 +3987,18 @@ static int manager_park(struct mansession *s, const struct message *m)
return 0;
}
+static int find_channel_by_group(struct ast_channel *c, void *data) {
+ struct ast_channel *chan = data;
+
+ return !c->pbx &&
+ /* Accessing 'chan' here is safe without locking, because there is no way for
+ the channel do disappear from under us at this point. pickupgroup *could*
+ change while we're here, but that isn't a problem. */
+ (c != chan) &&
+ (chan->pickupgroup & c->callgroup) &&
+ ((c->_state == AST_STATE_RINGING) || (c->_state == AST_STATE_RING));
+}
+
/*!
* \brief Pickup a call
* \param chan channel that initiated pickup.
@@ -3997,15 +4009,7 @@ static int manager_park(struct mansession *s, const struct message *m)
*/
int ast_pickup_call(struct ast_channel *chan)
{
- auto int find_channel_by_group(struct ast_channel *);
- int find_channel_by_group(struct ast_channel *c) {
- return !c->pbx &&
- (c != chan) &&
- (chan->pickupgroup & c->callgroup) &&
- ((c->_state == AST_STATE_RINGING) ||
- (c->_state == AST_STATE_RING));
- }
- struct ast_channel *cur = ast_channel_search_locked(find_channel_by_group);
+ struct ast_channel *cur = ast_channel_search_locked(find_channel_by_group, chan);
if (cur) {
int res = -1;