mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@155590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1227,14 +1227,14 @@ struct ast_channel *ast_walk_channel_by_exten_locked(const struct ast_channel *c
|
||||
}
|
||||
|
||||
/*! \brief Search for a channel based on the passed channel matching callback (first match) and return it, locked */
|
||||
struct ast_channel *ast_channel_search_locked(int (*is_match)(struct ast_channel *))
|
||||
struct ast_channel *ast_channel_search_locked(int (*is_match)(struct ast_channel *, void *), void *data)
|
||||
{
|
||||
struct ast_channel *c = NULL;
|
||||
|
||||
AST_RWLIST_RDLOCK(&channels);
|
||||
AST_RWLIST_TRAVERSE(&channels, c, chan_list) {
|
||||
ast_channel_lock(c);
|
||||
if (is_match(c)) {
|
||||
if (is_match(c, data)) {
|
||||
break;
|
||||
}
|
||||
ast_channel_unlock(c);
|
||||
|
Reference in New Issue
Block a user